diff --git a/benches/bench.rs b/benches/bench.rs index 8fd7eca..0c6e722 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -124,9 +124,7 @@ fn crc64_update_megabytes(bencher: &mut Bencher) { } fn crc64_construct_wellknown(bencher: &mut Bencher) { - bencher.iter(|| { - crc_any::CRCu64::crc64iso() - }) + bencher.iter(|| crc_any::CRCu64::crc64iso()) } fn crc64_update_megabytes_wellknown(bencher: &mut Bencher) { diff --git a/src/crc_u16.rs b/src/crc_u16.rs index c552ab4..13cedca 100644 --- a/src/crc_u16.rs +++ b/src/crc_u16.rs @@ -65,7 +65,15 @@ impl CRCu16 { reflect, ) } else { - Self::create(false, LookUpTable::Static(&[0u16; 256]), poly, bits, initial, final_xor, reflect) + Self::create( + false, + LookUpTable::Static(&[0u16; 256]), + poly, + bits, + initial, + final_xor, + reflect, + ) } } diff --git a/src/crc_u32.rs b/src/crc_u32.rs index bf49384..a7c137d 100644 --- a/src/crc_u32.rs +++ b/src/crc_u32.rs @@ -65,7 +65,15 @@ impl CRCu32 { reflect, ) } else { - Self::create(false, LookUpTable::Static(&[0u32; 256]), poly, bits, initial, final_xor, reflect) + Self::create( + false, + LookUpTable::Static(&[0u32; 256]), + poly, + bits, + initial, + final_xor, + reflect, + ) } } diff --git a/src/crc_u64.rs b/src/crc_u64.rs index 86e1540..b787d59 100644 --- a/src/crc_u64.rs +++ b/src/crc_u64.rs @@ -65,7 +65,15 @@ impl CRCu64 { reflect, ) } else { - Self::create(false, LookUpTable::Static(&[0u64; 256]), poly, bits, initial, final_xor, reflect) + Self::create( + false, + LookUpTable::Static(&[0u64; 256]), + poly, + bits, + initial, + final_xor, + reflect, + ) } } diff --git a/src/crc_u8.rs b/src/crc_u8.rs index 111b0e0..87ff7ba 100644 --- a/src/crc_u8.rs +++ b/src/crc_u8.rs @@ -60,7 +60,15 @@ impl CRCu8 { reflect, ) } else { - Self::create(false, LookUpTable::Static(&[0; 256]), poly, bits, initial, final_xor, reflect) + Self::create( + false, + LookUpTable::Static(&[0; 256]), + poly, + bits, + initial, + final_xor, + reflect, + ) } } diff --git a/src/lookup_table.rs b/src/lookup_table.rs index 0a7524a..b9f0edb 100644 --- a/src/lookup_table.rs +++ b/src/lookup_table.rs @@ -1,16 +1,16 @@ - /// This enum hold lookup table for static know or dynamic created table pub(crate) enum LookUpTable { Static(&'static [T]), - Dynamic([T;256]), + Dynamic([T; 256]), } impl core::ops::Deref for LookUpTable { type Target = [T]; + fn deref(&self) -> &[T] { match *self { LookUpTable::Static(s) => s, - LookUpTable::Dynamic(ref d) => d + LookUpTable::Dynamic(ref d) => d, } } }