Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit 2128495

Browse files
committed
Allow many single character names
When implementing `HashEngine` we use a bunch of local variables that are bytes within the hash. These are sequential so usage of a,b,c,... is perfectly readable and expressive. Shoosh clippy.
1 parent 7ea3d22 commit 2128495

File tree

6 files changed

+10
-16
lines changed

6 files changed

+10
-16
lines changed

src/cmp.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,8 @@ fn eq_test() {
8383
mod benches {
8484
use test::Bencher;
8585

86-
use sha256;
87-
use sha512;
88-
use Hash;
89-
use cmp::fixed_time_eq;
86+
use crate::{Hash, sha256, sha512};
87+
use crate::cmp::fixed_time_eq;
9088

9189
#[bench]
9290
fn bench_32b_constant_time_cmp_ne(bh: &mut Bencher) {

src/hmac.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,7 @@ mod tests {
390390
mod benches {
391391
use test::Bencher;
392392

393-
use sha256;
394-
use {Hmac, Hash, HashEngine};
393+
use crate::{Hmac, Hash, HashEngine, sha256};
395394

396395
#[bench]
397396
pub fn hmac_sha256_10(bh: & mut Bencher) {

src/sha1.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ impl crate::Hash for Hash {
137137
}
138138
}
139139

140+
#[allow(clippy::many_single_char_names)]
140141
impl HashEngine {
141142
// Basic unoptimized algorithm from Wikipedia
142143
fn process_block(&mut self) {
@@ -273,9 +274,7 @@ mod tests {
273274
mod benches {
274275
use test::Bencher;
275276

276-
use sha1;
277-
use Hash;
278-
use HashEngine;
277+
use crate::{Hash, HashEngine, sha1};
279278

280279
#[bench]
281280
pub fn sha1_10(bh: & mut Bencher) {

src/sha256.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ macro_rules! round(
230230
)
231231
);
232232

233+
#[allow(clippy::many_single_char_names)]
233234
impl HashEngine {
234235
/// Create a new [HashEngine] from a midstate.
235236
///
@@ -523,9 +524,7 @@ mod tests {
523524
mod benches {
524525
use test::Bencher;
525526

526-
use sha256;
527-
use Hash;
528-
use HashEngine;
527+
use crate::{Hash, HashEngine, sha256};
529528

530529
#[bench]
531530
pub fn sha256_10(bh: & mut Bencher) {

src/sha256d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ input: &'static str,
153153
mod benches {
154154
use test::Bencher;
155155

156-
use crate::{HashEngine, sha256d};
156+
use crate::{Hash, HashEngine, sha256d};
157157

158158
#[bench]
159159
pub fn sha256d_10(bh: & mut Bencher) {

src/sha512.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ macro_rules! round(
217217
)
218218
);
219219

220+
#[allow(clippy::many_single_char_names)]
220221
impl HashEngine {
221222
// Algorithm copied from libsecp256k1
222223
fn process_block(&mut self) {
@@ -442,9 +443,7 @@ mod tests {
442443
mod benches {
443444
use test::Bencher;
444445

445-
use sha512;
446-
use Hash;
447-
use HashEngine;
446+
use crate::{Hash, HashEngine, sha512};
448447

449448
#[bench]
450449
pub fn sha512_10(bh: & mut Bencher) {

0 commit comments

Comments
 (0)