Skip to content

Commit

Permalink
fix: fix all Clippy warnings on stable Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
vmx authored and Stebalien committed Oct 22, 2024
1 parent 1b5acef commit bbbba74
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
1 change: 0 additions & 1 deletion codetable/src/hasher_impl.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[cfg(any(
feature = "strobe",
feature = "identity",
feature = "blake2b",
feature = "blake2s",
feature = "blake3"
Expand Down
54 changes: 27 additions & 27 deletions codetable/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![cfg_attr(feature = "arb", allow(unreachable_code))] // Otherwise the "Cargo Hack" check fails since "arb" includes no hash algos by default
#![cfg_attr(docs_rs, feature(doc_cfg))]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(not(feature = "std"), no_std)]

//! A batteries-included code table of multihashes.
Expand All @@ -15,30 +15,30 @@ mod hasher_impl;
pub use multihash_derive::MultihashDigest;

#[cfg(feature = "blake2b")]
#[cfg_attr(docs_rs, doc(cfg(feature = "blake2b")))]
#[cfg_attr(docsrs, doc(cfg(feature = "blake2b")))]
pub use crate::hasher_impl::blake2b::{Blake2b256, Blake2b512, Blake2bHasher};
#[cfg(feature = "blake2s")]
#[cfg_attr(docs_rs, doc(cfg(feature = "blake2s")))]
#[cfg_attr(docsrs, doc(cfg(feature = "blake2s")))]
pub use crate::hasher_impl::blake2s::{Blake2s128, Blake2s256, Blake2sHasher};
#[cfg(feature = "blake3")]
#[cfg_attr(docs_rs, doc(cfg(feature = "blake3")))]
#[cfg_attr(docsrs, doc(cfg(feature = "blake3")))]
pub use crate::hasher_impl::blake3::{Blake3Hasher, Blake3_256};
#[cfg(feature = "ripemd")]
#[cfg_attr(docs_rs, doc(cfg(feature = "ripemd")))]
#[cfg_attr(docsrs, doc(cfg(feature = "ripemd")))]
pub use crate::hasher_impl::ripemd::{Ripemd160, Ripemd256, Ripemd320};
#[cfg(feature = "sha1")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha1")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha1")))]
pub use crate::hasher_impl::sha1::Sha1;
#[cfg(feature = "sha2")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha2")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha2")))]
pub use crate::hasher_impl::sha2::{Sha2_256, Sha2_512};
#[cfg(feature = "sha3")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha3")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha3")))]
pub use crate::hasher_impl::sha3::{
Keccak224, Keccak256, Keccak384, Keccak512, Sha3_224, Sha3_256, Sha3_384, Sha3_512,
};
#[cfg(feature = "strobe")]
#[cfg_attr(docs_rs, doc(cfg(feature = "strobe")))]
#[cfg_attr(docsrs, doc(cfg(feature = "strobe")))]
pub use crate::hasher_impl::strobe::{Strobe256, Strobe512, StrobeHasher};

/// Default (cryptographically secure) Multihash implementation.
Expand All @@ -54,92 +54,92 @@ pub use crate::hasher_impl::strobe::{Strobe256, Strobe512, StrobeHasher};
pub enum Code {
/// SHA-256 (32-byte hash size)
#[cfg(feature = "sha2")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha2")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha2")))]
#[mh(code = 0x12, hasher = crate::Sha2_256)]
Sha2_256,
/// SHA-512 (64-byte hash size)
#[cfg(feature = "sha2")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha2")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha2")))]
#[mh(code = 0x13, hasher = crate::Sha2_512)]
Sha2_512,
/// SHA3-224 (28-byte hash size)
#[cfg(feature = "sha3")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha3")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha3")))]
#[mh(code = 0x17, hasher = crate::Sha3_224)]
Sha3_224,
/// SHA3-256 (32-byte hash size)
#[cfg(feature = "sha3")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha3")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha3")))]
#[mh(code = 0x16, hasher = crate::Sha3_256)]
Sha3_256,
/// SHA3-384 (48-byte hash size)
#[cfg(feature = "sha3")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha3")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha3")))]
#[mh(code = 0x15, hasher = crate::Sha3_384)]
Sha3_384,
/// SHA3-512 (64-byte hash size)
#[cfg(feature = "sha3")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha3")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha3")))]
#[mh(code = 0x14, hasher = crate::Sha3_512)]
Sha3_512,
/// Keccak-224 (28-byte hash size)
#[cfg(feature = "sha3")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha3")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha3")))]
#[mh(code = 0x1a, hasher = crate::Keccak224)]
Keccak224,
/// Keccak-256 (32-byte hash size)
#[cfg(feature = "sha3")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha3")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha3")))]
#[mh(code = 0x1b, hasher = crate::Keccak256)]
Keccak256,
/// Keccak-384 (48-byte hash size)
#[cfg(feature = "sha3")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha3")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha3")))]
#[mh(code = 0x1c, hasher = crate::Keccak384)]
Keccak384,
/// Keccak-512 (64-byte hash size)
#[cfg(feature = "sha3")]
#[cfg_attr(docs_rs, doc(cfg(feature = "sha3")))]
#[cfg_attr(docsrs, doc(cfg(feature = "sha3")))]
#[mh(code = 0x1d, hasher = crate::Keccak512)]
Keccak512,
/// BLAKE2b-256 (32-byte hash size)
#[cfg(feature = "blake2b")]
#[cfg_attr(docs_rs, doc(cfg(feature = "blake2b")))]
#[cfg_attr(docsrs, doc(cfg(feature = "blake2b")))]
#[mh(code = 0xb220, hasher = crate::Blake2b256)]
Blake2b256,
/// BLAKE2b-512 (64-byte hash size)
#[cfg(feature = "blake2b")]
#[cfg_attr(docs_rs, doc(cfg(feature = "blake2b")))]
#[cfg_attr(docsrs, doc(cfg(feature = "blake2b")))]
#[mh(code = 0xb240, hasher = crate::Blake2b512)]
Blake2b512,
/// BLAKE2s-128 (16-byte hash size)
#[cfg(feature = "blake2s")]
#[cfg_attr(docs_rs, doc(cfg(feature = "blake2s")))]
#[cfg_attr(docsrs, doc(cfg(feature = "blake2s")))]
#[mh(code = 0xb250, hasher = crate::Blake2s128)]
Blake2s128,
/// BLAKE2s-256 (32-byte hash size)
#[cfg(feature = "blake2s")]
#[cfg_attr(docs_rs, doc(cfg(feature = "blake2s")))]
#[cfg_attr(docsrs, doc(cfg(feature = "blake2s")))]
#[mh(code = 0xb260, hasher = crate::Blake2s256)]
Blake2s256,
/// BLAKE3-256 (32-byte hash size)
#[cfg(feature = "blake3")]
#[cfg_attr(docs_rs, doc(cfg(feature = "blake3")))]
#[cfg_attr(docsrs, doc(cfg(feature = "blake3")))]
#[mh(code = 0x1e, hasher = crate::Blake3_256)]
Blake3_256,
/// RIPEMD-160 (20-byte hash size)
#[cfg(feature = "ripemd")]
#[cfg_attr(docs_rs, doc(cfg(feature = "ripemd")))]
#[cfg_attr(docsrs, doc(cfg(feature = "ripemd")))]
#[mh(code = 0x1053, hasher = crate::Ripemd160)]
Ripemd160,
/// RIPEMD-256 (32-byte hash size)
#[cfg(feature = "ripemd")]
#[cfg_attr(docs_rs, doc(cfg(feature = "ripemd")))]
#[cfg_attr(docsrs, doc(cfg(feature = "ripemd")))]
#[mh(code = 0x1054, hasher = crate::Ripemd256)]
Ripemd256,
/// RIPEMD-320 (40-byte hash size)
#[cfg(feature = "ripemd")]
#[cfg_attr(docs_rs, doc(cfg(feature = "ripemd")))]
#[cfg_attr(docsrs, doc(cfg(feature = "ripemd")))]
#[mh(code = 0x1055, hasher = crate::Ripemd320)]
Ripemd320,
}
Expand Down

0 comments on commit bbbba74

Please sign in to comment.