Skip to content

Commit 711acec

Browse files
committed
Fix clippy and remove remaining capstone reference in x86_64 tests
- Replace capstone test in asm/x86_64/tests.rs with built-in disassembler - Add clippy allows for vendored disassembler code (erasing_op, manual_range_contains, manual_range_patterns, etc.)
1 parent 5b2badd commit 711acec

3 files changed

Lines changed: 11 additions & 20 deletions

File tree

zjit/src/asm/x86_64/tests.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -943,24 +943,9 @@ fn test_xor() {
943943

944944
#[test]
945945
#[cfg(feature = "disasm")]
946-
fn basic_capstone_usage() -> std::result::Result<(), capstone::Error> {
947-
// Test drive Capstone with simple input
948-
use capstone::prelude::*;
949-
let cs = Capstone::new()
950-
.x86()
951-
.mode(arch::x86::ArchMode::Mode64)
952-
.syntax(arch::x86::ArchSyntax::Intel)
953-
.build()?;
954-
955-
let insns = cs.disasm_all(&[0xCC], 0x1000)?;
956-
957-
match insns.as_ref() {
958-
[insn] => {
959-
assert_eq!(Some("int3"), insn.mnemonic());
960-
Ok(())
961-
}
962-
_ => Err(capstone::Error::CustomError(
963-
"expected to disassemble to int3",
964-
)),
965-
}
946+
fn basic_disasm_usage() {
947+
// Test drive built-in disassembler with simple input
948+
let (text, len) = crate::disasm_x86_64::disassemble_one(&[0xCC], 0);
949+
assert_eq!(text, "int3");
950+
assert_eq!(len, 1);
966951
}

zjit/src/disasm_aarch64.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// Ported from the Dart SDK's runtime/vm/compiler/assembler/disassembler_arm64.cc
66
// to Rust. Pure Rust, no external dependencies.
77

8+
#![allow(clippy::manual_range_contains, clippy::needless_late_init)]
9+
810
/// Register names using standard ARM64 convention.
911
const CPU_REG_NAMES: [&str; 32] = [
1012
"x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11",

zjit/src/disasm_x86_64.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
// Ported from the Dart SDK's disassembler_x86.cc to Rust.
66
// X64 (long mode, 64-bit) only.
77

8+
#![allow(clippy::manual_range_contains, clippy::identity_op,
9+
clippy::unnecessary_cast, clippy::question_mark,
10+
clippy::manual_range_patterns, clippy::erasing_op)]
11+
812
use core::fmt::Write;
913

1014
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)