diff options
author | edef <edef@unfathomable.blue> | 2022-05-01 17:55:16 +0000 |
---|---|---|
committer | edef <edef@unfathomable.blue> | 2022-05-01 17:55:16 +0000 |
commit | 8bc30b82e3ad35a18a1696d3bdfa63902254abc0 (patch) | |
tree | 06a2a8ce9fa9655c4203b6063bdfce794a37b294 /ripple | |
parent | a2c1815bc2bbd9ff6da3edf50f2e914d28eeff54 (diff) | |
download | unf-legacy-8bc30b82e3ad35a18a1696d3bdfa63902254abc0.tar.zst |
ripple/fossil/chunker: remove Rolling::try_from_slice
We never actually use this directly, and the resulting branch is test coverage noise. Change-Id: Id32b056ca0cd57965d829085d768012e5a9e05ce
Diffstat (limited to 'ripple')
-rw-r--r-- | ripple/fossil/src/chunker/buz.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ripple/fossil/src/chunker/buz.rs b/ripple/fossil/src/chunker/buz.rs index 377f4f8..cd12833 100644 --- a/ripple/fossil/src/chunker/buz.rs +++ b/ripple/fossil/src/chunker/buz.rs @@ -25,16 +25,15 @@ pub struct Rolling<const N: usize> { impl<const N: usize> Rolling<N> { pub fn from_slice(input: &[u8]) -> Rolling<N> { - Self::try_from_slice(input).expect("need at least Rolling::WINDOW_SIZE bytes") - } - - pub fn try_from_slice(input: &[u8]) -> Option<Rolling<N>> { - let last_chunk = input.rchunks_exact(N).next()?; + let last_chunk = input + .rchunks_exact(N) + .next() + .expect("need at least Rolling::WINDOW_SIZE bytes"); let mut window = [0; N]; window.copy_from_slice(last_chunk); - Some(Self::new(&window)) + Self::new(&window) } pub fn new(window: &[u8; N]) -> Rolling<N> { |