hashes: Add additional must_use

Run the linter with `must_use_candidate` enabled and check all the
warnings.
This commit is contained in:
Tobin C. Harding 2024-12-09 17:05:27 +11:00
parent b9b8ddafde
commit f4b9c06c8b
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 0 deletions

View File

@ -135,6 +135,7 @@ impl crate::HashEngine for HashEngine {
impl Hash { impl Hash {
/// Iterate the sha256 algorithm to turn a sha256 hash into a sha256d hash /// Iterate the sha256 algorithm to turn a sha256 hash into a sha256d hash
#[must_use]
pub fn hash_again(&self) -> sha256d::Hash { pub fn hash_again(&self) -> sha256d::Hash {
crate::Hash::from_byte_array(<Self as crate::GeneralHash>::hash(&self.0).0) crate::Hash::from_byte_array(<Self as crate::GeneralHash>::hash(&self.0).0)
} }
@ -202,6 +203,7 @@ impl Midstate {
/// ///
/// Computes non-finalized hash of `sha256(tag) || sha256(tag)` for use in [`sha256t`]. It's /// Computes non-finalized hash of `sha256(tag) || sha256(tag)` for use in [`sha256t`]. It's
/// provided for use with [`sha256t`]. /// provided for use with [`sha256t`].
#[must_use]
pub const fn hash_tag(tag: &[u8]) -> Self { pub const fn hash_tag(tag: &[u8]) -> Self {
let hash = Hash::hash_unoptimized(tag); let hash = Hash::hash_unoptimized(tag);
let mut buf = [0u8; 64]; let mut buf = [0u8; 64];