Skip to content

Commit 6fe20b2

Browse files
authored
Merge pull request #37 from RustCrypto/github-actions/workspace-config-and-clippy-cleanups
.github: run rustfmt + clippy in CI; clippy fixups
2 parents f586feb + 928c534 commit 6fe20b2

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

.github/workflows/workspace.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Workspace
2+
3+
on:
4+
pull_request:
5+
paths-ignore:
6+
- README.md
7+
push:
8+
branches: master
9+
paths-ignore:
10+
- README.md
11+
12+
jobs:
13+
clippy:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v1
17+
- uses: actions-rs/toolchain@v1
18+
with:
19+
profile: minimal
20+
toolchain: 1.41.0 # MSRV
21+
components: clippy
22+
- run: cargo clippy --all -- -D warnings
23+
24+
rustfmt:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout sources
28+
uses: actions/checkout@v1
29+
30+
- name: Install stable toolchain
31+
uses: actions-rs/toolchain@v1
32+
with:
33+
profile: minimal
34+
toolchain: stable
35+
components: rustfmt
36+
37+
- name: Run cargo fmt
38+
uses: actions-rs/cargo@v1
39+
with:
40+
command: fmt
41+
args: --all -- --check

daa/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")]
2121
#![forbid(unsafe_code)]
2222
#![warn(missing_docs, rust_2018_idioms)]
23+
#![allow(clippy::needless_range_loop)]
2324

2425
pub use crypto_mac::{self, Mac, NewMac};
2526

@@ -88,7 +89,7 @@ impl Mac for Daa {
8889
}
8990
}
9091

91-
if data.len() != 0 {
92+
if !data.is_empty() {
9293
self.cipher.encrypt_block(&mut self.buffer);
9394
for (a, b) in self.buffer.iter_mut().zip(data) {
9495
*a ^= *b;

pmac/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ where
103103
l_cache[i] = l_cache[i - 1].clone().dbl();
104104
}
105105

106-
let l_inv = l0.clone().inv_dbl();
106+
let l_inv = l0.inv_dbl();
107107

108108
Self {
109109
cipher,
@@ -222,7 +222,7 @@ where
222222

223223
self.pos = n;
224224

225-
if data.len() != 0 {
225+
if !data.is_empty() {
226226
self.process_buffer();
227227
self.as_mut_bytes()[..data.len()].clone_from_slice(data);
228228
self.pos = data.len();

0 commit comments

Comments
 (0)