Skip to content

Commit f756cb8

Browse files
committed
fix clippy lints
1 parent d24706e commit f756cb8

File tree

6 files changed

+13
-4
lines changed

6 files changed

+13
-4
lines changed

blake2/src/as_bytes.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
use core::mem;
99
use core::slice;
1010

11+
/// # Safety
12+
///
13+
/// T is safe to implement Safe if any bit level manipulation of its memory region
14+
/// (including possible alignment padding) still yields a valid instance of T
15+
/// and its use is always sound.
1116
pub unsafe trait Safe {}
1217

1318
pub trait AsBytes {

blake2/src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ macro_rules! blake2_impl {
109109

110110
#[inline(always)]
111111
fn quarter_round(v: &mut [$vec; 4], rd: u32, rb: u32, m: $vec) {
112-
v[0] = v[0].wrapping_add(v[1]).wrapping_add(m.from_le());
112+
v[0] = v[0].wrapping_add(v[1]).wrapping_add($vec::from_le(m));
113113
v[3] = (v[3] ^ v[0]).rotate_right_const(rd);
114114
v[2] = v[2].wrapping_add(v[3]);
115115
v[1] = (v[1] ^ v[2]).rotate_right_const(rb);

blake2/src/simd.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub use self::simdty::{u32x4, u64x4};
1515
pub trait Vector4<T>: Copy {
1616
fn gather(src: &[T], i0: usize, i1: usize, i2: usize, i3: usize) -> Self;
1717

18-
fn from_le(self) -> Self;
18+
fn from_le(vec: Self) -> Self;
1919
fn to_le(self) -> Self;
2020

2121
fn wrapping_add(self, rhs: Self) -> Self;
@@ -50,8 +50,8 @@ macro_rules! impl_vector4 {
5050

5151
#[cfg(target_endian = "little")]
5252
#[inline(always)]
53-
fn from_le(self) -> Self {
54-
self
53+
fn from_le(vec: Self) -> Self {
54+
vec
5555
}
5656

5757
#[cfg(not(target_endian = "little"))]

sha1/src/compress/soft.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ fn sha1_digest_block_u32(state: &mut [u32; 5], block: &[u32; 16]) {
201201
let mut w1 = [block[4], block[5], block[6], block[7]];
202202
let mut w2 = [block[8], block[9], block[10], block[11]];
203203
let mut w3 = [block[12], block[13], block[14], block[15]];
204+
#[allow(clippy::needless_late_init)]
204205
let mut w4;
205206

206207
let mut h0 = [state[0], state[1], state[2], state[3]];

sha1/src/compress/x86.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ unsafe fn digest_blocks(state: &mut [u32; 5], blocks: &[[u8; 64]]) {
5252
let mut w1 = _mm_shuffle_epi8(_mm_loadu_si128(block_ptr.offset(1)), MASK);
5353
let mut w2 = _mm_shuffle_epi8(_mm_loadu_si128(block_ptr.offset(2)), MASK);
5454
let mut w3 = _mm_shuffle_epi8(_mm_loadu_si128(block_ptr.offset(3)), MASK);
55+
#[allow(clippy::needless_late_init)]
5556
let mut w4;
5657

5758
let mut h0 = state_abcd;

whirlpool/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ impl WhirlpoolCore {
126126
}
127127
}
128128

129+
// derivable impl does not inline
130+
#[allow(clippy::derivable_impls)]
129131
impl Default for WhirlpoolCore {
130132
#[inline]
131133
fn default() -> Self {

0 commit comments

Comments
 (0)