Drop unnecessary mut

pull/597/head
Kenjiro Nakayama 2 years ago
parent 0a1f1a2898
commit e67025b66f

@ -531,7 +531,7 @@ impl Btf {
// Fixup FUNC_PROTO // Fixup FUNC_PROTO
BtfType::FuncProto(ty) if features.btf_func => { BtfType::FuncProto(ty) if features.btf_func => {
let mut ty = ty.clone(); 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 { if param.name_offset == 0 && param.btf_type != 0 {
param.name_offset = self.add_string(format!("param{i}")); param.name_offset = self.add_string(format!("param{i}"));
} }

@ -855,7 +855,7 @@ impl ComputedRelocation {
let instructions = &mut program.function.instructions; let instructions = &mut program.function.instructions;
let num_instructions = instructions.len(); let num_instructions = instructions.len();
let ins_index = rel.ins_offset / mem::size_of::<bpf_insn>(); let ins_index = rel.ins_offset / mem::size_of::<bpf_insn>();
let mut ins = let ins =
instructions instructions
.get_mut(ins_index) .get_mut(ins_index)
.ok_or(RelocationError::InvalidInstructionIndex { .ok_or(RelocationError::InvalidInstructionIndex {
@ -934,7 +934,7 @@ impl ComputedRelocation {
} }
BPF_LD => { BPF_LD => {
ins.imm = target_value as i32; 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 { RelocationError::InvalidInstructionIndex {
index: ins_index + 1, index: ins_index + 1,
num_instructions, num_instructions,

@ -429,7 +429,7 @@ impl<'a> FunctionLinker<'a> {
let callee_ins_index = self.link_function(program, callee)? as i32; 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; let ins_index = ins_index as i32;
ins.imm = callee_ins_index - ins_index - 1; ins.imm = callee_ins_index - ins_index - 1;
debug!( debug!(

Loading…
Cancel
Save