Merge rust-bitcoin/rust-bitcoin#3714: hashes: Add `must_use`
f4b9c06c8b
hashes: Add additional must_use (Tobin C. Harding)b9b8ddafde
hashes: Add lint return_self_must_use (Tobin C. Harding) Pull request description: Enable `return_self_must_use` and also run the linter locally with `must_use_candidate`. Add `must_use` attribute as required excluding obvious functions (conversion, getters, etc). Done as part of #3185 ACKs for top commit: apoelstra: ACK f4b9c06c8bdffccfe997135f7b6ec168978e9bcc; successfully ran local tests; nice! will one-ACK merge sanket1729: utACKf4b9c06c8b
Tree-SHA512: 26668e5871a9d3d1ba71974a656227904dca5d553b2466b5bca2253c0aa020fa71c548b17d03aff9ebeca62d4a194cf6d227d5d248391b9b26646ccda400c29d
This commit is contained in:
commit
b2a60b9d3f
|
@ -58,6 +58,8 @@
|
|||
#![warn(missing_docs)]
|
||||
#![warn(deprecated_in_future)]
|
||||
#![doc(test(attr(warn(unused))))]
|
||||
// Pedantic lints that we enforce.
|
||||
#![warn(clippy::return_self_not_must_use)]
|
||||
// Instead of littering the codebase for non-fuzzing and bench code just globally allow.
|
||||
#![cfg_attr(hashes_fuzz, allow(dead_code, unused_imports))]
|
||||
#![cfg_attr(bench, allow(dead_code, unused_imports))]
|
||||
|
|
|
@ -135,6 +135,7 @@ impl crate::HashEngine for HashEngine {
|
|||
|
||||
impl Hash {
|
||||
/// Iterate the sha256 algorithm to turn a sha256 hash into a sha256d hash
|
||||
#[must_use]
|
||||
pub fn hash_again(&self) -> sha256d::Hash {
|
||||
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
|
||||
/// provided for use with [`sha256t`].
|
||||
#[must_use]
|
||||
pub const fn hash_tag(tag: &[u8]) -> Self {
|
||||
let hash = Hash::hash_unoptimized(tag);
|
||||
let mut buf = [0u8; 64];
|
||||
|
|
Loading…
Reference in New Issue