Skip to content

Commit

Permalink
fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Cass Fridkin authored and sharksforarms committed Jan 12, 2023
1 parent 0476763 commit f712a6b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions examples/example.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::unusual_byte_groupings)]

use deku::prelude::*;
use std::convert::{TryFrom, TryInto};

Expand Down
2 changes: 1 addition & 1 deletion src/impls/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mod tests {
let bit_slice = input.view_bits::<Msb0>();

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;];
Expand Down
4 changes: 2 additions & 2 deletions src/impls/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#![allow(clippy::unusual_byte_groupings, clippy::redundant_closure_call)]

mod test_attributes;
mod test_compile;
1 change: 1 addition & 0 deletions tests/test_attributes/test_padding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions tests/test_from_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions tests/test_struct.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::unusual_byte_groupings)]

use deku::prelude::*;
use std::convert::{TryFrom, TryInto};

Expand Down

0 comments on commit f712a6b

Please sign in to comment.