summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ripple/fossil/src/chunker/buz.rs11
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> {