Skip to content

Commit 0898069

Browse files
committed
clippy
1 parent ae11cb6 commit 0898069

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

nova_vm/src/engine/bytecode/instructions.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -704,17 +704,15 @@ pub(crate) struct Instr<'a> {
704704

705705
impl<'a> Instr<'a> {
706706
pub(super) fn consume_instruction(instructions: &'a [u8], ip: &mut usize) -> Option<Self> {
707-
let Some(kind_at) = instructions.get(*ip) else {
708-
return None;
709-
};
707+
let kind_at = instructions.get(*ip)?;
710708
let Ok(kind) = Instruction::try_from(*kind_at) else {
711709
panic_invalid_instruction()
712710
};
713711
// SAFETY: we checked above the kind is Ok.
714712
let ptr = NonNull::from_ref(kind_at).cast::<Instruction>();
715713

716714
let byte_count = match kind.argument_count() {
717-
value @ (0 | 1 | 2) => (value * 2) as usize,
715+
value @ (0..=2) => (value * 2) as usize,
718716
_ => panic_invalid_instruction(),
719717
};
720718
*ip += byte_count + 1;

tests/expectations.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7026,4 +7026,4 @@
70267026
"staging/sm/syntax/yield-as-identifier.js": "FAIL",
70277027
"staging/source-phase-imports/import-source-source-text-module.js": "FAIL",
70287028
"staging/top-level-await/tla-hang-entry.js": "FAIL"
7029-
}
7029+
}

tests/metrics.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
"unresolved": 37
99
},
1010
"total": 50733
11-
}
11+
}

0 commit comments

Comments
 (0)