Skip to content

Commit ebafc6c

Browse files
committed
Fix Clippy reports
$ cargo clippy --fix -- -D clippy::all -A clippy::match_same_arms Signed-off-by: Quentin Monnet <[email protected]>
1 parent 57bc9ad commit ebafc6c

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/assembler.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,10 @@ fn assemble_internal(parsed: &[Instruction]) -> Result<Vec<Insn>, String> {
215215
Err(msg) => return Err(format!("Failed to encode {name}: {msg}")),
216216
}
217217
// Special case for lddw.
218-
if let LoadImm = inst_type {
219-
if let Integer(imm) = instruction.operands[1] {
218+
if let LoadImm = inst_type
219+
&& let Integer(imm) = instruction.operands[1] {
220220
result.push(insn(0, 0, 0, 0, imm >> 32).unwrap());
221221
}
222-
}
223222
}
224223
None => return Err(format!("Invalid instruction {name:?}")),
225224
}

src/interpreter.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,10 @@ pub fn execute_program(
116116
let mut insn_ptr: usize = 0;
117117
while insn_ptr * ebpf::INSN_SIZE < prog.len() {
118118
let insn = ebpf::get_insn(prog, insn_ptr);
119-
if stack_frame_idx < MAX_CALL_DEPTH {
120-
if let Some(usage) = stack_usage.stack_usage_for_local_func(insn_ptr) {
119+
if stack_frame_idx < MAX_CALL_DEPTH
120+
&& let Some(usage) = stack_usage.stack_usage_for_local_func(insn_ptr) {
121121
stacks[stack_frame_idx].set_stack_usage(usage);
122122
}
123-
}
124123
insn_ptr += 1;
125124
let _dst = insn.dst as usize;
126125
let _src = insn.src as usize;

0 commit comments

Comments
 (0)