diff --git a/examples/example.rs b/examples/example.rs index 7b7f98f7..6e957d33 100644 --- a/examples/example.rs +++ b/examples/example.rs @@ -1,3 +1,5 @@ +#![allow(clippy::unusual_byte_groupings)] + use deku::prelude::*; use std::convert::{TryFrom, TryInto}; diff --git a/src/impls/bool.rs b/src/impls/bool.rs index 7b438c2f..9bbf28ac 100644 --- a/src/impls/bool.rs +++ b/src/impls/bool.rs @@ -73,7 +73,7 @@ mod tests { let bit_slice = input.view_bits::(); let (rest, res_read) = bool::read(bit_slice, crate::ctx::BitSize(2)).unwrap(); - assert_eq!(true, res_read); + assert!(res_read); assert_eq!(6, rest.len()); let mut res_write = bitvec![u8, Msb0;]; diff --git a/src/impls/primitive.rs b/src/impls/primitive.rs index 0c819a6f..5ebfdca3 100644 --- a/src/impls/primitive.rs +++ b/src/impls/primitive.rs @@ -52,10 +52,10 @@ impl DekuRead<'_, (Endian, ByteSize)> for u8 { // read manually let mut res: u8 = 0; for b in bytes.iter().rev() { - res |= *b as u8; + res |= *b; } - res as u8 + res }; Ok((rest, value)) diff --git a/src/lib.rs b/src/lib.rs index a2210e10..2eca1d08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -261,6 +261,7 @@ pub struct EncodedString { */ #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::unusual_byte_groupings)] #[cfg(feature = "alloc")] extern crate alloc; diff --git a/tests/mod.rs b/tests/mod.rs index 21fe0f3d..a61389cf 100644 --- a/tests/mod.rs +++ b/tests/mod.rs @@ -1,2 +1,4 @@ +#![allow(clippy::unusual_byte_groupings, clippy::redundant_closure_call)] + mod test_attributes; mod test_compile; diff --git a/tests/test_attributes/test_padding/mod.rs b/tests/test_attributes/test_padding/mod.rs index 4d2606e9..a54bd259 100644 --- a/tests/test_attributes/test_padding/mod.rs +++ b/tests/test_attributes/test_padding/mod.rs @@ -7,6 +7,7 @@ mod test_pad_bytes_after; mod test_pad_bytes_before; #[test] +#[allow(clippy::identity_op)] fn test_pad_bits_before_and_pad_bytes_before() { #[derive(PartialEq, Debug, DekuRead, DekuWrite)] struct TestStruct { diff --git a/tests/test_from_bytes.rs b/tests/test_from_bytes.rs index c1eb987d..dd14d587 100644 --- a/tests/test_from_bytes.rs +++ b/tests/test_from_bytes.rs @@ -12,17 +12,17 @@ fn test_from_bytes_struct() { assert_eq!(2, rest.len()); assert_eq!(4, i); - let ((rest, i), ret_read) = TestDeku::from_bytes((&rest, i)).unwrap(); + let ((rest, i), ret_read) = TestDeku::from_bytes((rest, i)).unwrap(); assert_eq!(TestDeku(0b0110), ret_read); assert_eq!(1, rest.len()); assert_eq!(0, i); - let ((rest, i), ret_read) = TestDeku::from_bytes((&rest, i)).unwrap(); + let ((rest, i), ret_read) = TestDeku::from_bytes((rest, i)).unwrap(); assert_eq!(TestDeku(0b0101), ret_read); assert_eq!(1, rest.len()); assert_eq!(4, i); - let ((rest, i), ret_read) = TestDeku::from_bytes((&rest, i)).unwrap(); + let ((rest, i), ret_read) = TestDeku::from_bytes((rest, i)).unwrap(); assert_eq!(TestDeku(0b1010), ret_read); assert_eq!(0, rest.len()); assert_eq!(0, i); @@ -46,7 +46,7 @@ fn test_from_bytes_enum() { assert_eq!(1, rest.len()); assert_eq!(0, i); - let ((rest, i), ret_read) = TestDeku::from_bytes((&rest, i)).unwrap(); + let ((rest, i), ret_read) = TestDeku::from_bytes((rest, i)).unwrap(); assert_eq!(TestDeku::VariantB(0b10), ret_read); assert_eq!(1, rest.len()); assert_eq!(6, i); diff --git a/tests/test_struct.rs b/tests/test_struct.rs index 6436c6b1..c620af5d 100644 --- a/tests/test_struct.rs +++ b/tests/test_struct.rs @@ -1,3 +1,5 @@ +#![allow(clippy::unusual_byte_groupings)] + use deku::prelude::*; use std::convert::{TryFrom, TryInto};