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

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow many single character names
Browse files Browse the repository at this point in the history
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.
tcharding committed Oct 27, 2021

Verified

This commit was signed with the committer’s verified signature. The key has expired.
tvdeyen Thomas von Deyen
1 parent 7ea3d22 commit 2128495
Showing 6 changed files with 10 additions and 16 deletions.
6 changes: 2 additions & 4 deletions src/cmp.rs
Original file line number Diff line number Diff line change
@@ -83,10 +83,8 @@ fn eq_test() {
mod benches {
use test::Bencher;

use sha256;
use sha512;
use Hash;
use cmp::fixed_time_eq;
use crate::{Hash, sha256, sha512};
use crate::cmp::fixed_time_eq;

#[bench]
fn bench_32b_constant_time_cmp_ne(bh: &mut Bencher) {
3 changes: 1 addition & 2 deletions src/hmac.rs
Original file line number Diff line number Diff line change
@@ -390,8 +390,7 @@ mod tests {
mod benches {
use test::Bencher;

use sha256;
use {Hmac, Hash, HashEngine};
use crate::{Hmac, Hash, HashEngine, sha256};

#[bench]
pub fn hmac_sha256_10(bh: & mut Bencher) {
5 changes: 2 additions & 3 deletions src/sha1.rs
Original file line number Diff line number Diff line change
@@ -137,6 +137,7 @@ impl crate::Hash for Hash {
}
}

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

use sha1;
use Hash;
use HashEngine;
use crate::{Hash, HashEngine, sha1};

#[bench]
pub fn sha1_10(bh: & mut Bencher) {
5 changes: 2 additions & 3 deletions src/sha256.rs
Original file line number Diff line number Diff line change
@@ -230,6 +230,7 @@ macro_rules! round(
)
);

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

use sha256;
use Hash;
use HashEngine;
use crate::{Hash, HashEngine, sha256};

#[bench]
pub fn sha256_10(bh: & mut Bencher) {
2 changes: 1 addition & 1 deletion src/sha256d.rs
Original file line number Diff line number Diff line change
@@ -153,7 +153,7 @@ input: &'static str,
mod benches {
use test::Bencher;

use crate::{HashEngine, sha256d};
use crate::{Hash, HashEngine, sha256d};

#[bench]
pub fn sha256d_10(bh: & mut Bencher) {
5 changes: 2 additions & 3 deletions src/sha512.rs
Original file line number Diff line number Diff line change
@@ -217,6 +217,7 @@ macro_rules! round(
)
);

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

use sha512;
use Hash;
use HashEngine;
use crate::{Hash, HashEngine, sha512};

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

0 comments on commit 2128495

Please sign in to comment.