From 0fb584a12a3ff8295f7fe2d23b314aef6396daec Mon Sep 17 00:00:00 2001 From: Cesar Eduardo Barros Date: Sun, 11 Feb 2018 20:27:55 -0200 Subject: [PATCH] Clean clippy warnings --- clippy.toml | 1 + src/blake2.rs | 2 +- src/blake2b.rs | 2 ++ src/blake2s.rs | 2 ++ src/bytes.rs | 1 + src/lib.rs | 1 + src/simdty.rs | 5 ++++- 7 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 clippy.toml diff --git a/clippy.toml b/clippy.toml new file mode 100644 index 0000000..04e3c8e --- /dev/null +++ b/clippy.toml @@ -0,0 +1 @@ +doc-valid-idents = ["BLAKE2b", "BLAKE2s"] diff --git a/src/blake2.rs b/src/blake2.rs index d244dc2..28959c4 100644 --- a/src/blake2.rs +++ b/src/blake2.rs @@ -303,7 +303,7 @@ macro_rules! blake2_impl { } } -#[cfg_attr(feature = "cargo-clippy", allow(cast_possible_truncation))] +#[cfg_attr(feature = "cargo-clippy", allow(cast_possible_truncation, unreadable_literal))] #[cold] pub fn selftest_seq(len: usize) -> ArrayVec<[u8; 1024]> { use core::num::Wrapping; diff --git a/src/blake2b.rs b/src/blake2b.rs index 0e93599..055556d 100644 --- a/src/blake2b.rs +++ b/src/blake2b.rs @@ -34,6 +34,8 @@ //! a byte string (the comparison will take constant time), or converted //! into a byte string. +#![cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))] + blake2_impl!(Blake2b, Blake2bResult, blake2b, u64, u64x4, 64, 32, 24, 16, 63, [ 0x6A09E667F3BCC908, 0xBB67AE8584CAA73B, 0x3C6EF372FE94F82B, 0xA54FF53A5F1D36F1, diff --git a/src/blake2s.rs b/src/blake2s.rs index b864d35..ccda2b2 100644 --- a/src/blake2s.rs +++ b/src/blake2s.rs @@ -34,6 +34,8 @@ //! a byte string (the comparison will take constant time), or converted //! into a byte string. +#![cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))] + blake2_impl!(Blake2s, Blake2sResult, blake2s, u32, u32x4, 32, 16, 12, 8, 7, [ 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19, diff --git a/src/bytes.rs b/src/bytes.rs index a075b5e..7f8aed7 100644 --- a/src/bytes.rs +++ b/src/bytes.rs @@ -10,6 +10,7 @@ use core::ptr; /// Operations on byte slices. +#[cfg_attr(feature = "cargo-clippy", allow(stutter))] pub trait BytesExt { /// Set all bytes of this slice to the same value. /// diff --git a/src/lib.rs b/src/lib.rs index bf882ed..929436f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,7 @@ #![warn(missing_docs)] #![cfg_attr(feature = "cargo-clippy", warn(clippy_pedantic))] +#![cfg_attr(feature = "cargo-clippy", allow(missing_docs_in_private_items))] #![cfg_attr(all(feature = "bench", test), feature(test))] #![cfg_attr(feature = "simd", feature(platform_intrinsics, repr_simd))] diff --git a/src/simdty.rs b/src/simdty.rs index ba058b0..98d539a 100644 --- a/src/simdty.rs +++ b/src/simdty.rs @@ -8,6 +8,9 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] +// https://github.com/rust-lang-nursery/rust-clippy/issues/2453 +#![cfg_attr(feature = "cargo-clippy", allow(empty_line_after_outer_attr))] + use as_bytes::Safe; #[cfg(feature = "simd")] @@ -67,7 +70,7 @@ pub type u8x32 = Simd32; #[cfg_attr(feature = "cargo-clippy", allow(inline_always))] impl Simd4 { #[inline(always)] - pub fn new(e0: T, e1: T, e2: T, e3: T) -> Simd4 { + pub fn new(e0: T, e1: T, e2: T, e3: T) -> Self { Simd4(e0, e1, e2, e3) } }