Skip to content

Commit

Permalink
run rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
magiclen committed Oct 23, 2021
1 parent 2a1f03c commit b373b59
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 10 deletions.
4 changes: 1 addition & 3 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 9 additions & 1 deletion src/crc_u16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
}

Expand Down
10 changes: 9 additions & 1 deletion src/crc_u32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
}

Expand Down
10 changes: 9 additions & 1 deletion src/crc_u64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
}

Expand Down
10 changes: 9 additions & 1 deletion src/crc_u8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/lookup_table.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@

/// This enum hold lookup table for static know or dynamic created table
pub(crate) enum LookUpTable<T: 'static> {
Static(&'static [T]),
Dynamic([T;256]),
Dynamic([T; 256]),
}

impl<T> core::ops::Deref for LookUpTable<T> {
type Target = [T];

fn deref(&self) -> &[T] {
match *self {
LookUpTable::Static(s) => s,
LookUpTable::Dynamic(ref d) => d
LookUpTable::Dynamic(ref d) => d,
}
}
}

0 comments on commit b373b59

Please sign in to comment.