From 8bc30b82e3ad35a18a1696d3bdfa63902254abc0 Mon Sep 17 00:00:00 2001 From: edef Date: Sun, 1 May 2022 17:55:16 +0000 Subject: 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 --- ripple/fossil/src/chunker/buz.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'ripple/fossil/src/chunker') 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 { impl Rolling { pub fn from_slice(input: &[u8]) -> Rolling { - Self::try_from_slice(input).expect("need at least Rolling::WINDOW_SIZE bytes") - } - - pub fn try_from_slice(input: &[u8]) -> Option> { - 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 { -- cgit 1.4.1