From e67025b66f08592bb7e9a3273d56eb5669b16d90 Mon Sep 17 00:00:00 2001 From: Kenjiro Nakayama Date: Mon, 1 May 2023 17:25:10 +0900 Subject: [PATCH] Drop unnecessary mut --- aya-obj/src/btf/btf.rs | 2 +- aya-obj/src/btf/relocation.rs | 4 ++-- aya-obj/src/relocation.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aya-obj/src/btf/btf.rs b/aya-obj/src/btf/btf.rs index 45c943b9..325a8aef 100644 --- a/aya-obj/src/btf/btf.rs +++ b/aya-obj/src/btf/btf.rs @@ -531,7 +531,7 @@ impl Btf { // Fixup FUNC_PROTO BtfType::FuncProto(ty) if features.btf_func => { let mut ty = ty.clone(); - for (i, mut param) in ty.params.iter_mut().enumerate() { + for (i, param) in ty.params.iter_mut().enumerate() { if param.name_offset == 0 && param.btf_type != 0 { param.name_offset = self.add_string(format!("param{i}")); } diff --git a/aya-obj/src/btf/relocation.rs b/aya-obj/src/btf/relocation.rs index dbfd25ac..3098ab7f 100644 --- a/aya-obj/src/btf/relocation.rs +++ b/aya-obj/src/btf/relocation.rs @@ -855,7 +855,7 @@ impl ComputedRelocation { let instructions = &mut program.function.instructions; let num_instructions = instructions.len(); let ins_index = rel.ins_offset / mem::size_of::(); - let mut ins = + let ins = instructions .get_mut(ins_index) .ok_or(RelocationError::InvalidInstructionIndex { @@ -934,7 +934,7 @@ impl ComputedRelocation { } BPF_LD => { ins.imm = target_value as i32; - let mut next_ins = instructions.get_mut(ins_index + 1).ok_or( + let next_ins = instructions.get_mut(ins_index + 1).ok_or( RelocationError::InvalidInstructionIndex { index: ins_index + 1, num_instructions, diff --git a/aya-obj/src/relocation.rs b/aya-obj/src/relocation.rs index 407ab288..55eccb5a 100644 --- a/aya-obj/src/relocation.rs +++ b/aya-obj/src/relocation.rs @@ -429,7 +429,7 @@ impl<'a> FunctionLinker<'a> { let callee_ins_index = self.link_function(program, callee)? as i32; - let mut ins = &mut program.instructions[ins_index]; + let ins = &mut program.instructions[ins_index]; let ins_index = ins_index as i32; ins.imm = callee_ins_index - ins_index - 1; debug!(