From 37872054c29930b4bc2fcd784d3597aa242b752d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Damien?= Date: Fri, 28 Jul 2023 10:17:23 +0200 Subject: [PATCH] Makes clippym happy --- src/lib.rs | 2 ++ tests/lib.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 965a89e..5533eea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -640,6 +640,7 @@ macro_rules! impl_bitrange_for_u { impl BitRange<$bitrange_ty> for $t { #[inline] #[allow(clippy::cast_lossless)] + #[allow(clippy::manual_bits)] fn bit_range(&self, msb: usize, lsb: usize) -> $bitrange_ty { let bit_len = size_of::<$t>()*8; let result_bit_len = size_of::<$bitrange_ty>()*8; @@ -652,6 +653,7 @@ macro_rules! impl_bitrange_for_u { impl BitRangeMut<$bitrange_ty> for $t { #[inline] #[allow(clippy::cast_lossless)] + #[allow(clippy::manual_bits)] fn set_bit_range(&mut self, msb: usize, lsb: usize, value: $bitrange_ty) { let bit_len = size_of::<$t>()*8; let mask: $t = !(0 as $t) diff --git a/tests/lib.rs b/tests/lib.rs index ceca8b9..7053968 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -100,35 +100,35 @@ fn test_single_bit() { assert_eq!(0x1, fb.0); assert_eq!(0x1, fb.foo1()); assert_eq!(0x0, fb.foo2()); - assert_eq!(false, fb.single_bit()); + assert!(!fb.single_bit()); assert_eq!(-1, fb.signed_single_bit()); fb.set_foo2(1); assert_eq!(0x8000_0001, fb.0); assert_eq!(0x1, fb.foo1()); assert_eq!(0x1, fb.foo2()); - assert_eq!(false, fb.single_bit()); + assert!(!fb.single_bit()); assert_eq!(-1, fb.signed_single_bit()); fb.set_foo1(0); assert_eq!(0x8000_0000, fb.0); assert_eq!(0x0, fb.foo1()); assert_eq!(0x1, fb.foo2()); - assert_eq!(false, fb.single_bit()); + assert!(!fb.single_bit()); assert_eq!(0, fb.signed_single_bit()); fb.set_single_bit(true); assert_eq!(0x8000_0008, fb.0); assert_eq!(0x0, fb.foo1()); assert_eq!(0x1, fb.foo2()); - assert_eq!(true, fb.single_bit()); + assert!(fb.single_bit()); assert_eq!(0, fb.signed_single_bit()); fb.set_signed_single_bit(-1); assert_eq!(0x8000_0009, fb.0); assert_eq!(0x1, fb.foo1()); assert_eq!(0x1, fb.foo2()); - assert_eq!(true, fb.single_bit()); + assert!(fb.single_bit()); assert_eq!(-1, fb.signed_single_bit()); } @@ -939,7 +939,7 @@ mod test_no_default_bitrange { let mut bf = BitField1(0); assert_eq!(bf.field1(), 10 + 0); assert_eq!(bf.field2(), 12 + 3); - assert_eq!(bf.field3(), true); + assert!(bf.field3()); bf.set_field1(42); assert_eq!(bf, BitField1(10 + 0 + 42)); }