Skip to content

Commit

Permalink
Fix clippy errors within tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kixiron committed Dec 15, 2021
1 parent d2acccc commit 0743040
Show file tree
Hide file tree
Showing 26 changed files with 214 additions and 215 deletions.
1 change: 0 additions & 1 deletion src/rust/iced-x86/src/code_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
//!
//! [`CodeAssembler`]: struct.CodeAssembler.html

#[doc(hidden)]
#[allow(missing_docs, clippy::missing_errors_doc)]
pub mod asm_traits;
mod code_asm_methods;
Expand Down
20 changes: 10 additions & 10 deletions src/rust/iced-x86/src/code_asm/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ fn test_prefixes_dup() {
fn prefixes_without_instr_fails_assemble() {
#[rustfmt::skip]
let set_prefixes: &[fn(&mut CodeAssembler) -> &mut CodeAssembler] = &[
|a| a.xacquire(),
|a| a.xrelease(),
|a| a.lock(),
|a| a.rep(),
|a| a.repe(),
|a| a.repz(),
|a| a.repne(),
|a| a.repnz(),
|a| a.bnd(),
|a| a.notrack(),
CodeAssembler::xacquire,
CodeAssembler::xrelease,
CodeAssembler::lock,
CodeAssembler::rep,
CodeAssembler::repe,
CodeAssembler::repz,
CodeAssembler::repne,
CodeAssembler::repnz,
CodeAssembler::bnd,
CodeAssembler::notrack,
];
for set_prefix in set_prefixes {
let mut a = CodeAssembler::new(64).unwrap();
Expand Down
136 changes: 68 additions & 68 deletions src/rust/iced-x86/src/encoder/tests/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2782,40 +2782,40 @@ fn create_fails_if_invalid_bitness() {
|bitness| Instruction::with_movsq(bitness, Register::FS, RepPrefixKind::None),
|bitness| Instruction::with_maskmovq(bitness, Register::MM2, Register::MM3, Register::FS),
|bitness| Instruction::with_maskmovdqu(bitness, Register::XMM2, Register::XMM3, Register::FS),
|bitness| Instruction::with_rep_outsb(bitness),
|bitness| Instruction::with_rep_outsw(bitness),
|bitness| Instruction::with_rep_outsd(bitness),
|bitness| Instruction::with_repe_scasb(bitness),
|bitness| Instruction::with_repe_scasw(bitness),
|bitness| Instruction::with_repe_scasd(bitness),
|bitness| Instruction::with_repe_scasq(bitness),
|bitness| Instruction::with_repne_scasb(bitness),
|bitness| Instruction::with_repne_scasw(bitness),
|bitness| Instruction::with_repne_scasd(bitness),
|bitness| Instruction::with_repne_scasq(bitness),
|bitness| Instruction::with_rep_lodsb(bitness),
|bitness| Instruction::with_rep_lodsw(bitness),
|bitness| Instruction::with_rep_lodsd(bitness),
|bitness| Instruction::with_rep_lodsq(bitness),
|bitness| Instruction::with_rep_insb(bitness),
|bitness| Instruction::with_rep_insw(bitness),
|bitness| Instruction::with_rep_insd(bitness),
|bitness| Instruction::with_rep_stosb(bitness),
|bitness| Instruction::with_rep_stosw(bitness),
|bitness| Instruction::with_rep_stosd(bitness),
|bitness| Instruction::with_rep_stosq(bitness),
|bitness| Instruction::with_repe_cmpsb(bitness),
|bitness| Instruction::with_repe_cmpsw(bitness),
|bitness| Instruction::with_repe_cmpsd(bitness),
|bitness| Instruction::with_repe_cmpsq(bitness),
|bitness| Instruction::with_repne_cmpsb(bitness),
|bitness| Instruction::with_repne_cmpsw(bitness),
|bitness| Instruction::with_repne_cmpsd(bitness),
|bitness| Instruction::with_repne_cmpsq(bitness),
|bitness| Instruction::with_rep_movsb(bitness),
|bitness| Instruction::with_rep_movsw(bitness),
|bitness| Instruction::with_rep_movsd(bitness),
|bitness| Instruction::with_rep_movsq(bitness),
Instruction::with_rep_outsb,
Instruction::with_rep_outsw,
Instruction::with_rep_outsd,
Instruction::with_repe_scasb,
Instruction::with_repe_scasw,
Instruction::with_repe_scasd,
Instruction::with_repe_scasq,
Instruction::with_repne_scasb,
Instruction::with_repne_scasw,
Instruction::with_repne_scasd,
Instruction::with_repne_scasq,
Instruction::with_rep_lodsb,
Instruction::with_rep_lodsw,
Instruction::with_rep_lodsd,
Instruction::with_rep_lodsq,
Instruction::with_rep_insb,
Instruction::with_rep_insw,
Instruction::with_rep_insd,
Instruction::with_rep_stosb,
Instruction::with_rep_stosw,
Instruction::with_rep_stosd,
Instruction::with_rep_stosq,
Instruction::with_repe_cmpsb,
Instruction::with_repe_cmpsw,
Instruction::with_repe_cmpsd,
Instruction::with_repe_cmpsq,
Instruction::with_repne_cmpsb,
Instruction::with_repne_cmpsw,
Instruction::with_repne_cmpsd,
Instruction::with_repne_cmpsq,
Instruction::with_rep_movsb,
Instruction::with_rep_movsw,
Instruction::with_rep_movsd,
Instruction::with_rep_movsq,
];
create_fails_if_invalid_bitness_core(tests);
}
Expand Down Expand Up @@ -2854,40 +2854,40 @@ fn create_fails_if_invalid_bitness_deprec() {
|bitness| Instruction::try_with_movsq(bitness, Register::FS, RepPrefixKind::None),
|bitness| Instruction::try_with_maskmovq(bitness, Register::MM2, Register::MM3, Register::FS),
|bitness| Instruction::try_with_maskmovdqu(bitness, Register::XMM2, Register::XMM3, Register::FS),
|bitness| Instruction::try_with_rep_outsb(bitness),
|bitness| Instruction::try_with_rep_outsw(bitness),
|bitness| Instruction::try_with_rep_outsd(bitness),
|bitness| Instruction::try_with_repe_scasb(bitness),
|bitness| Instruction::try_with_repe_scasw(bitness),
|bitness| Instruction::try_with_repe_scasd(bitness),
|bitness| Instruction::try_with_repe_scasq(bitness),
|bitness| Instruction::try_with_repne_scasb(bitness),
|bitness| Instruction::try_with_repne_scasw(bitness),
|bitness| Instruction::try_with_repne_scasd(bitness),
|bitness| Instruction::try_with_repne_scasq(bitness),
|bitness| Instruction::try_with_rep_lodsb(bitness),
|bitness| Instruction::try_with_rep_lodsw(bitness),
|bitness| Instruction::try_with_rep_lodsd(bitness),
|bitness| Instruction::try_with_rep_lodsq(bitness),
|bitness| Instruction::try_with_rep_insb(bitness),
|bitness| Instruction::try_with_rep_insw(bitness),
|bitness| Instruction::try_with_rep_insd(bitness),
|bitness| Instruction::try_with_rep_stosb(bitness),
|bitness| Instruction::try_with_rep_stosw(bitness),
|bitness| Instruction::try_with_rep_stosd(bitness),
|bitness| Instruction::try_with_rep_stosq(bitness),
|bitness| Instruction::try_with_repe_cmpsb(bitness),
|bitness| Instruction::try_with_repe_cmpsw(bitness),
|bitness| Instruction::try_with_repe_cmpsd(bitness),
|bitness| Instruction::try_with_repe_cmpsq(bitness),
|bitness| Instruction::try_with_repne_cmpsb(bitness),
|bitness| Instruction::try_with_repne_cmpsw(bitness),
|bitness| Instruction::try_with_repne_cmpsd(bitness),
|bitness| Instruction::try_with_repne_cmpsq(bitness),
|bitness| Instruction::try_with_rep_movsb(bitness),
|bitness| Instruction::try_with_rep_movsw(bitness),
|bitness| Instruction::try_with_rep_movsd(bitness),
|bitness| Instruction::try_with_rep_movsq(bitness),
Instruction::try_with_rep_outsb,
Instruction::try_with_rep_outsw,
Instruction::try_with_rep_outsd,
Instruction::try_with_repe_scasb,
Instruction::try_with_repe_scasw,
Instruction::try_with_repe_scasd,
Instruction::try_with_repe_scasq,
Instruction::try_with_repne_scasb,
Instruction::try_with_repne_scasw,
Instruction::try_with_repne_scasd,
Instruction::try_with_repne_scasq,
Instruction::try_with_rep_lodsb,
Instruction::try_with_rep_lodsw,
Instruction::try_with_rep_lodsd,
Instruction::try_with_rep_lodsq,
Instruction::try_with_rep_insb,
Instruction::try_with_rep_insw,
Instruction::try_with_rep_insd,
Instruction::try_with_rep_stosb,
Instruction::try_with_rep_stosw,
Instruction::try_with_rep_stosd,
Instruction::try_with_rep_stosq,
Instruction::try_with_repe_cmpsb,
Instruction::try_with_repe_cmpsw,
Instruction::try_with_repe_cmpsd,
Instruction::try_with_repe_cmpsq,
Instruction::try_with_repne_cmpsb,
Instruction::try_with_repne_cmpsw,
Instruction::try_with_repne_cmpsd,
Instruction::try_with_repne_cmpsq,
Instruction::try_with_rep_movsb,
Instruction::try_with_rep_movsw,
Instruction::try_with_rep_movsd,
Instruction::try_with_rep_movsq,
];
create_fails_if_invalid_bitness_core(tests);
}
Expand Down
14 changes: 7 additions & 7 deletions src/rust/iced-x86/src/formatter/gas/tests/fmt_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn create_fmt2(symbol_resolver: Option<Box<dyn SymbolResolver>>, options_provide
fmt
}

pub(super) fn create_nosuffix() -> Box<GasFormatter> {
pub(super) fn create_nosuffix() -> Box<dyn Formatter> {
let mut fmt = create_fmt();
fmt.options_mut().set_gas_show_mnemonic_size_suffix(false);
fmt.options_mut().set_gas_naked_registers(false);
Expand All @@ -27,7 +27,7 @@ pub(super) fn create_nosuffix() -> Box<GasFormatter> {
fmt
}

pub(super) fn create_forcesuffix() -> Box<GasFormatter> {
pub(super) fn create_forcesuffix() -> Box<dyn Formatter> {
let mut fmt = create_fmt();
fmt.options_mut().set_gas_show_mnemonic_size_suffix(true);
fmt.options_mut().set_gas_naked_registers(true);
Expand All @@ -39,7 +39,7 @@ pub(super) fn create_forcesuffix() -> Box<GasFormatter> {
fmt
}

pub(super) fn create() -> Box<GasFormatter> {
pub(super) fn create() -> Box<dyn Formatter> {
let mut fmt = create_fmt();
fmt.options_mut().set_gas_show_mnemonic_size_suffix(false);
fmt.options_mut().set_gas_naked_registers(false);
Expand All @@ -48,7 +48,7 @@ pub(super) fn create() -> Box<GasFormatter> {
fmt
}

pub(super) fn create_options() -> Box<GasFormatter> {
pub(super) fn create_options() -> Box<dyn Formatter> {
let mut fmt = create_fmt();
fmt.options_mut().set_gas_show_mnemonic_size_suffix(false);
fmt.options_mut().set_gas_naked_registers(false);
Expand All @@ -57,13 +57,13 @@ pub(super) fn create_options() -> Box<GasFormatter> {
fmt
}

pub(super) fn create_registers(naked_registers: bool) -> Box<GasFormatter> {
pub(super) fn create_registers(naked_registers: bool) -> Box<dyn Formatter> {
let mut fmt = create_fmt();
fmt.options_mut().set_gas_naked_registers(naked_registers);
fmt
}

pub(super) fn create_numbers() -> Box<GasFormatter> {
pub(super) fn create_numbers() -> Box<dyn Formatter> {
let mut fmt = create_fmt();
fmt.options_mut().set_uppercase_hex(true);
fmt.options_mut().set_hex_prefix("");
Expand All @@ -77,7 +77,7 @@ pub(super) fn create_numbers() -> Box<GasFormatter> {
fmt
}

pub(super) fn create_resolver(symbol_resolver: Box<dyn SymbolResolver>) -> Box<GasFormatter> {
pub(super) fn create_resolver(symbol_resolver: Box<dyn SymbolResolver>) -> Box<dyn Formatter> {
let mut fmt = create_fmt2(Some(symbol_resolver), None);
fmt.options_mut().set_gas_show_mnemonic_size_suffix(false);
fmt.options_mut().set_gas_naked_registers(false);
Expand Down
4 changes: 2 additions & 2 deletions src/rust/iced-x86/src/formatter/gas/tests/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ use alloc::string::String;

#[test]
fn methods_panic_if_invalid_operand_or_instruction_operand() {
misc::methods_panic_if_invalid_operand_or_instruction_operand(|| fmt_factory::create());
misc::methods_panic_if_invalid_operand_or_instruction_operand(fmt_factory::create);
}

#[test]
fn test_op_index() {
misc::test_op_index(|| fmt_factory::create());
misc::test_op_index(fmt_factory::create);
}

#[test]
Expand Down
30 changes: 15 additions & 15 deletions src/rust/iced-x86/src/formatter/gas/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,81 +15,81 @@ use crate::formatter::tests::formatter_test_nondec;

#[test]
fn fmt_forcesuffix_16() {
formatter_test(16, "Gas", "ForceSuffix", false, || create_forcesuffix());
formatter_test(16, "Gas", "ForceSuffix", false, create_forcesuffix);
}

#[test]
fn fmt_nosuffix_16() {
formatter_test(16, "Gas", "NoSuffix", false, || create_nosuffix());
formatter_test(16, "Gas", "NoSuffix", false, create_nosuffix);
}

#[test]
fn fmt_misc_16() {
formatter_test(16, "Gas", "Misc", true, || create());
formatter_test(16, "Gas", "Misc", true, create);
}

#[test]
#[cfg(feature = "encoder")]
fn fmt_nondec_forcesuffix_16() {
formatter_test_nondec(16, "Gas", "NonDec_ForceSuffix", || create_forcesuffix());
formatter_test_nondec(16, "Gas", "NonDec_ForceSuffix", create_forcesuffix);
}

#[test]
#[cfg(feature = "encoder")]
fn fmt_nondec_nosuffix_16() {
formatter_test_nondec(16, "Gas", "NonDec_NoSuffix", || create_nosuffix());
formatter_test_nondec(16, "Gas", "NonDec_NoSuffix", create_nosuffix);
}

#[test]
fn fmt_forcesuffix_32() {
formatter_test(32, "Gas", "ForceSuffix", false, || create_forcesuffix());
formatter_test(32, "Gas", "ForceSuffix", false, create_forcesuffix);
}

#[test]
fn fmt_nosuffix_32() {
formatter_test(32, "Gas", "NoSuffix", false, || create_nosuffix());
formatter_test(32, "Gas", "NoSuffix", false, create_nosuffix);
}

#[test]
fn fmt_misc_32() {
formatter_test(32, "Gas", "Misc", true, || create());
formatter_test(32, "Gas", "Misc", true, create);
}

#[test]
#[cfg(feature = "encoder")]
fn fmt_nondec_forcesuffix_32() {
formatter_test_nondec(32, "Gas", "NonDec_ForceSuffix", || create_forcesuffix());
formatter_test_nondec(32, "Gas", "NonDec_ForceSuffix", create_forcesuffix);
}

#[test]
#[cfg(feature = "encoder")]
fn fmt_nondec_nosuffix_32() {
formatter_test_nondec(32, "Gas", "NonDec_NoSuffix", || create_nosuffix());
formatter_test_nondec(32, "Gas", "NonDec_NoSuffix", create_nosuffix);
}

#[test]
fn fmt_forcesuffix_64() {
formatter_test(64, "Gas", "ForceSuffix", false, || create_forcesuffix());
formatter_test(64, "Gas", "ForceSuffix", false, create_forcesuffix);
}

#[test]
fn fmt_nosuffix_64() {
formatter_test(64, "Gas", "NoSuffix", false, || create_nosuffix());
formatter_test(64, "Gas", "NoSuffix", false, create_nosuffix);
}

#[test]
fn fmt_misc_64() {
formatter_test(64, "Gas", "Misc", true, || create());
formatter_test(64, "Gas", "Misc", true, create);
}

#[test]
#[cfg(feature = "encoder")]
fn fmt_nondec_forcesuffix_64() {
formatter_test_nondec(64, "Gas", "NonDec_ForceSuffix", || create_forcesuffix());
formatter_test_nondec(64, "Gas", "NonDec_ForceSuffix", create_forcesuffix);
}

#[test]
#[cfg(feature = "encoder")]
fn fmt_nondec_nosuffix_64() {
formatter_test_nondec(64, "Gas", "NonDec_NoSuffix", || create_nosuffix());
formatter_test_nondec(64, "Gas", "NonDec_NoSuffix", create_nosuffix);
}
2 changes: 1 addition & 1 deletion src/rust/iced-x86/src/formatter/gas/tests/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ use crate::formatter::tests::number::number_tests;

#[test]
fn test_numbers() {
number_tests(|| create_numbers());
number_tests(create_numbers);
}
6 changes: 3 additions & 3 deletions src/rust/iced-x86/src/formatter/gas/tests/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ use crate::formatter::tests::options::{test_format_file, test_format_file_all, t

#[test]
fn test_options_common() {
test_format_file_common("Gas", "OptionsResult.Common", || fmt_factory::create_options());
test_format_file_common("Gas", "OptionsResult.Common", fmt_factory::create_options);
}

#[test]
fn test_options_all() {
test_format_file_all("Gas", "OptionsResult", || fmt_factory::create_options());
test_format_file_all("Gas", "OptionsResult", fmt_factory::create_options);
}

#[test]
fn test_options2() {
test_format_file("Gas", "OptionsResult2", "Options2", || fmt_factory::create_options());
test_format_file("Gas", "OptionsResult2", "Options2", fmt_factory::create_options);
}
Loading

0 comments on commit 0743040

Please sign in to comment.