Skip to content

Commit

Permalink
Remove more code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanUkhov committed Apr 28, 2024
1 parent fa16259 commit 10d4e5c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,9 @@ impl core::io::Write for Context {
/// Compute the digest of data.
#[allow(clippy::needless_range_loop)]
pub fn compute<T: AsRef<[u8]>>(data: T) -> Digest {
let Context {
mut state,
mut buffer,
mut cursor,
mut length,
} = Context::new();
consume(&mut state, &mut buffer, &mut cursor, &mut length, data.as_ref());
finalize(&mut state, &mut buffer, cursor, length)
let mut context = Context::new();
context.consume(data);
context.finalize()
}

#[inline(always)]
Expand Down

0 comments on commit 10d4e5c

Please sign in to comment.