Open TheAifam5 opened 3 years ago
Adding repr to the struct results in a clippy warning:
repr
the operation is ineffective. Consider reducing it to `mregion: u8`
Adding #[allow(clippy::identity_op)] on top of the struct does not disable the warning.
#[allow(clippy::identity_op)]
Example (straight from the test):
use modular_bitfield::prelude::*; #[bitfield] #[repr(u32)] #[derive(Debug, PartialEq, Eq)] struct TtResp { mregion: u8, sregion: u8, mrvalid: bool, srvalid: bool, r: bool, rw: bool, nsr: bool, nsrw: bool, s: bool, irvalid: bool, iregion: u8, }
Rust: 1.52.0-nightly (d6eaea1c8 2021-03-14) Clippy: 0.1.52 (d6eaea1c 2021-03-14) Crate Version: 0.11.2
As a workaround until the PR is merged, if you specify the number of bits to use for the struct the clippy warning is also removed. The above code would change to:
#[bitfield(bits = 32)] #[repr(u32)] struct ...
Adding
repr
to the struct results in a clippy warning:Adding
#[allow(clippy::identity_op)]
on top of the struct does not disable the warning.Example (straight from the test):
Rust: 1.52.0-nightly (d6eaea1c8 2021-03-14) Clippy: 0.1.52 (d6eaea1c 2021-03-14) Crate Version: 0.11.2