diff --git a/digest/src/digest.rs b/digest/src/digest.rs index 29aeb5dac..1a332505d 100644 --- a/digest/src/digest.rs +++ b/digest/src/digest.rs @@ -196,9 +196,9 @@ impl DynDigest for D { } fn finalize_into(self, buf: &mut [u8]) -> Result<(), InvalidBufferSize> { - let buf = <&mut Output>::try_from(buf).map_err(|_| InvalidBufferSize)?; - FixedOutput::finalize_into(self, buf); - Ok(()) + buf.try_into() + .map_err(|_| InvalidBufferSize) + .map(|buf| FixedOutput::finalize_into(self, buf)) } fn finalize_into_reset(&mut self, buf: &mut [u8]) -> Result<(), InvalidBufferSize> {