Closed
Description
Summary
The integer_arithmetic
lint triggers in code generated by derive macros.
It seems this is a slightly broader issue affecting multiple lints, e.g. #9657, #7845.
If the right solution is to check any_parent_is_automatically_derived
or in_external_macro
I would be happy to do the implementation for integer_arithmetic
.
Reproducer
I tried this code with arbitrary@1.2.2
:
#![deny(clippy::integer_arithmetic)]
use arbitrary::Arbitrary;
#[derive(Arbitrary)]
pub struct Thing {
pub x: u64,
}
The error is:
error: integer arithmetic detected
--> src/lib.rs:5:10
|
5 | #[derive(Arbitrary)]
| ^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#integer_arithmetic
note: the lint level is defined here
--> src/lib.rs:1:9
|
1 | #![deny(clippy::integer_arithmetic)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `Arbitrary` (in Nightly builds, run with -Z macro-backtrace for more info)
Version
rustc 1.66.0 (69f9c33d7 2022-12-12)
binary: rustc
commit-hash: 69f9c33d71c871fc16ac445211281c6e7a340943
commit-date: 2022-12-12
host: x86_64-unknown-linux-gnu
release: 1.66.0
LLVM version: 15.0.2
Additional Labels
No response