Skip to content

Commit

Permalink
Enable Rust's unused-macro-rules lint
Browse files Browse the repository at this point in the history
This is allow-by-default in the compiler but looks like it's got a high
fidelity for us where we don't use macros super heavily, so let's try
having it enabled.
  • Loading branch information
alexcrichton committed Oct 1, 2024
1 parent 9bd2979 commit a98e456
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 25 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ trivial_numeric_casts = 'warn'
unstable_features = 'warn'
unused_import_braces = 'warn'
unused-lifetimes = 'warn'
unused-macro-rules = 'warn'

[workspace.lints.clippy]
# The default set of lints in Clippy is viewed as "too noisy" right now so
Expand Down
16 changes: 0 additions & 16 deletions cranelift/interpreter/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,6 @@ macro_rules! unary_match {
_ => unimplemented!()
}
};
( $op:tt($arg1:expr); [ $( $data_value_ty:ident ),* ] ) => {
match $arg1 {
$( DataValue::$data_value_ty(a) => { Ok(DataValue::$data_value_ty($op a)) } )*
_ => unimplemented!()
}
};
}
macro_rules! binary_match {
( $op:ident($arg1:expr, $arg2:expr); [ $( $data_value_ty:ident ),* ] ) => {
Expand Down Expand Up @@ -229,16 +223,6 @@ macro_rules! binary_match {
_ => unimplemented!()
}
};
( $op:ident($arg1:expr, $arg2:expr); unsigned integers ) => {
match ($arg1, $arg2) {
(DataValue::I8(a), DataValue::I8(b)) => { Ok(DataValue::I8((u8::try_from(*a)?.$op(u8::try_from(*b)?) as i8))) }
(DataValue::I16(a), DataValue::I16(b)) => { Ok(DataValue::I16((u16::try_from(*a)?.$op(u16::try_from(*b)?) as i16))) }
(DataValue::I32(a), DataValue::I32(b)) => { Ok(DataValue::I32((u32::try_from(*a)?.$op(u32::try_from(*b)?) as i32))) }
(DataValue::I64(a), DataValue::I64(b)) => { Ok(DataValue::I64((u64::try_from(*a)?.$op(u64::try_from(*b)?) as i64))) }
(DataValue::I128(a), DataValue::I128(b)) => { Ok(DataValue::I128((u128::try_from(*a)?.$op(u128::try_from(*b)?) as i64))) }
_ => { Err(ValueError::InvalidType(ValueTypeClass::Integer, if !($arg1).ty().is_int() { ($arg1).ty() } else { ($arg2).ty() })) }
}
};
}

macro_rules! bitop {
Expand Down
4 changes: 0 additions & 4 deletions crates/wasmtime/src/runtime/vm/component/libcalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,13 @@ impl VMComponentLibcalls {

macro_rules! signature {
(@ty size) => (usize);
(@ty size_pair) => (usize);
(@ty ptr_u8) => (*mut u8);
(@ty ptr_u16) => (*mut u16);
(@ty ptr_size) => (*mut usize);
(@ty u8) => (u8);
(@ty u32) => (u32);
(@ty u64) => (u64);
(@ty vmctx) => (*mut VMComponentContext);

(@retptr size_pair) => (*mut usize);
(@retptr $other:ident) => (());
}

/// Defines a `VMComponentBuiltins` structure which contains any builtins such
Expand Down
1 change: 0 additions & 1 deletion crates/wasmtime/src/runtime/vm/libcalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ pub mod raw {
(@ty u8) => (u8);
(@ty reference) => (u32);
(@ty pointer) => (*mut u8);
(@ty vmctx) => (*mut VMContext);
}

wasmtime_environ::foreach_builtin_function!(libcall);
Expand Down
3 changes: 0 additions & 3 deletions pulley/src/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ macro_rules! define_extended_opcode {
pub const MAX: u16 = define_opcode!( @max $( $name )* );
}
};

( @max $x:ident ) => { 0 };
( @max $x:ident $( $xs:ident )* ) => { 1 + define_opcode!(@max $( $xs )* ) };
}
for_each_extended_op!(define_extended_opcode);

Expand Down
1 change: 0 additions & 1 deletion winch/codegen/src/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ macro_rules! def_unsupported {
(emit I64Load32U $($rest:tt)*) => {};
(emit I64Load $($rest:tt)*) => {};
(emit I32Store $($rest:tt)*) => {};
(emit I32Store $($rest:tt)*) => {};
(emit I32Store8 $($rest:tt)*) => {};
(emit I32Store16 $($rest:tt)*) => {};
(emit I64Store $($rest:tt)*) => {};
Expand Down

0 comments on commit a98e456

Please sign in to comment.