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

Commit ab09e0e

Browse files
committed
Merge #152: Enable clippy in CI
d31b579 CI: Enable clippy (Tobin C. Harding) 1433fd7 Remove unneeded initial variable declaration (Tobin C. Harding) d3eab6b Use field init shorthand (Tobin C. Harding) d995a34 Add clippy config file (Tobin C. Harding) Pull request description: Enable running `clippy` on CI, involves doing: - Add config file - Clear all `clippy` warnings - Add CI job to run `clippy` ACKs for top commit: apoelstra: ACK d31b579 Tree-SHA512: e675af732f40a886621cbddda5c3570695fb81043680b3093908bdde71d4bd3947580b519e3c41b3463d30f1c408081b7c561c98f06d513501b1e5d4111b8211
2 parents aff0e6f + d31b579 commit ab09e0e

File tree

6 files changed

+26
-10
lines changed

6 files changed

+26
-10
lines changed

.github/workflows/rust.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ jobs:
3434
DO_DOCS: true
3535
run: ./contrib/test.sh
3636

37+
Clippy:
38+
name: Clippy
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- uses: actions-rs/toolchain@v1
43+
with:
44+
profile: minimal
45+
toolchain: stable
46+
override: true
47+
- run: rustup component add clippy
48+
- uses: actions-rs/cargo@v1
49+
with:
50+
command: clippy
51+
args: --all-features -- -D warnings
52+
3753
wasm:
3854
name: Stable - WebAssembly Build
3955
runs-on: ubuntu-latest

clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
msrv = "1.41.1"

src/hex.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,11 @@ impl<T: Hash> FromHex for T {
8484
where
8585
I: Iterator<Item = Result<u8, Error>> + ExactSizeIterator + DoubleEndedIterator,
8686
{
87-
let inner;
88-
if Self::DISPLAY_BACKWARD {
89-
inner = T::Inner::from_byte_iter(iter.rev())?;
87+
let inner = if Self::DISPLAY_BACKWARD {
88+
T::Inner::from_byte_iter(iter.rev())?
9089
} else {
91-
inner = T::Inner::from_byte_iter(iter)?;
92-
}
90+
T::Inner::from_byte_iter(iter)?
91+
};
9392
Ok(Hash::from_inner(inner))
9493
}
9594
}

src/hmac.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ impl<T: Hash> HmacEngine<T> {
104104
/// A special constructor giving direct access to the underlying "inner" and "outer" engines.
105105
pub fn from_inner_engines(iengine: T::Engine, oengine: T::Engine) -> HmacEngine<T> {
106106
HmacEngine {
107-
iengine: iengine,
108-
oengine: oengine,
107+
iengine,
108+
oengine,
109109
}
110110
}
111111
}

src/sha256.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl HashEngine {
269269
HashEngine {
270270
buffer: [0; BLOCK_SIZE],
271271
h: ret,
272-
length: length,
272+
length,
273273
}
274274
}
275275

src/siphash24.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ impl HashEngine {
9494
/// Creates a new SipHash24 engine with keys.
9595
pub fn with_keys(k0: u64, k1: u64) -> HashEngine {
9696
HashEngine {
97-
k0: k0,
98-
k1: k1,
97+
k0,
98+
k1,
9999
length: 0,
100100
state: State {
101101
v0: k0 ^ 0x736f6d6570736575,

0 commit comments

Comments
 (0)