Skip to content

Commit fd1cf9d

Browse files
committed
Cargo.toml: add workspace-level clippy config
Adds a set of workspace-level lints including common ones we've used in the past and others collected via running `clippy::pedantic` on several of our crates and looking for interesting ones. Workspace-level lints require explict opt-in from each crate's Cargo.toml, so there's nothing forcing any crate to use them: [lints] workspace = true That said, I have opted every crate in the workspace into these lints and gotten them all to pass except for `wycheproof2blb` which is an internal utility tool and I didn't feel like it was worth the hassle. Even then, the lints are all set to `"warn"`, so they can be easily overridden by `#[allow(...)]` attributes, including `#![allow(...)]` to shut them off at the granularity of an entire crate. I managed to fix most of the issues that `cargo clippy --fix` didn't fix automatically including some missing documentation and documentation formatting issues. The main thing I didn't fix was adding missing `SAFETY` comments, which is a problem with a few of the crates in this repo. I disabled a lint at the crate level and added a TODO where we're missing them and it wasn't easily corrected.
1 parent 3524aa8 commit fd1cf9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+450
-280
lines changed

.github/workflows/blobby.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: blobby
22

33
on:
44
pull_request:
5-
paths:
6-
- "blobby/**"
7-
- "Cargo.*"
5+
paths:
6+
- "blobby/**"
7+
- "Cargo.*"
88
push:
99
branches: master
1010

@@ -38,11 +38,4 @@ jobs:
3838
- uses: dtolnay/rust-toolchain@master
3939
with:
4040
toolchain: ${{ matrix.rust }}
41-
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
42-
- run: rm ../Cargo.toml
4341
- run: cargo test
44-
45-
minimal-versions:
46-
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
47-
with:
48-
working-directory: ${{ github.workflow }}

.github/workflows/block-buffer.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: block-buffer
22

33
on:
44
pull_request:
5-
paths:
6-
- "block-buffer/**"
7-
- "Cargo.*"
5+
paths:
6+
- "block-buffer/**"
7+
- "Cargo.*"
88
push:
99
branches: master
1010

@@ -44,10 +44,11 @@ jobs:
4444
targets: ${{ matrix.target }}
4545
- run: cargo build --target ${{ matrix.target }}
4646

47-
minimal-versions:
48-
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
49-
with:
50-
working-directory: ${{ github.workflow }}
47+
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
48+
# minimal-versions:
49+
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
50+
# with:
51+
# working-directory: ${{ github.workflow }}
5152

5253
test:
5354
runs-on: ubuntu-latest

.github/workflows/block-padding.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: block-padding
22

33
on:
44
pull_request:
5-
paths:
6-
- "block-padding/**"
7-
- "Cargo.*"
5+
paths:
6+
- "block-padding/**"
7+
- "Cargo.*"
88
push:
99
branches: master
1010

@@ -44,10 +44,11 @@ jobs:
4444
targets: ${{ matrix.target }}
4545
- run: cargo build --target ${{ matrix.target }}
4646

47-
minimal-versions:
48-
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
49-
with:
50-
working-directory: ${{ github.workflow }}
47+
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
48+
# minimal-versions:
49+
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
50+
# with:
51+
# working-directory: ${{ github.workflow }}
5152

5253
test:
5354
runs-on: ubuntu-latest

.github/workflows/cmov.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ concurrency:
2626
cancel-in-progress: true
2727

2828
jobs:
29-
minimal-versions:
30-
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
31-
with:
32-
working-directory: ${{ github.workflow }}
29+
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
30+
# minimal-versions:
31+
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
32+
# with:
33+
# working-directory: ${{ github.workflow }}
3334

3435
build:
3536
runs-on: ubuntu-latest

.github/workflows/cpufeatures.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ concurrency:
2525
cancel-in-progress: true
2626

2727
jobs:
28-
minimal-versions:
29-
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
30-
with:
31-
working-directory: ${{ github.workflow }}
28+
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
29+
# minimal-versions:
30+
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
31+
# with:
32+
# working-directory: ${{ github.workflow }}
3233

3334
# Linux tests
3435
linux:
@@ -56,8 +57,6 @@ jobs:
5657
with:
5758
toolchain: ${{ matrix.rust }}
5859
targets: ${{ matrix.target }}
59-
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
60-
- run: rm ../Cargo.toml
6160
- run: ${{ matrix.deps }}
6261
- run: cargo test --target ${{ matrix.target }}
6362

@@ -76,8 +75,6 @@ jobs:
7675
with:
7776
toolchain: ${{ matrix.toolchain }}
7877
targets: x86_64-apple-darwin
79-
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
80-
- run: rm ../Cargo.toml
8178
- run: cargo test
8279

8380
# Windows tests
@@ -98,8 +95,6 @@ jobs:
9895
with:
9996
toolchain: ${{ matrix.toolchain }}
10097
targets: ${{ matrix.target }}
101-
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
102-
- run: rm ../Cargo.toml
10398
- run: cargo test --target ${{ matrix.target }}
10499

105100
# Cross-compiled tests
@@ -121,8 +116,6 @@ jobs:
121116
toolchain: ${{ matrix.rust }}
122117
targets: ${{ matrix.target }}
123118
- uses: RustCrypto/actions/cross-install@master
124-
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
125-
- run: rm ../Cargo.toml
126119
- run: cross test --target ${{ matrix.target }}
127120

128121
# Build-only tests

.github/workflows/dbl.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ jobs:
4545
targets: ${{ matrix.target }}
4646
- run: cargo build --target ${{ matrix.target }}
4747

48-
minimal-versions:
49-
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
50-
with:
51-
working-directory: ${{ github.workflow }}
48+
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
49+
# minimal-versions:
50+
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
51+
# with:
52+
# working-directory: ${{ github.workflow }}
5253

5354
test:
5455
runs-on: ubuntu-latest

.github/workflows/hex-literal.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: hex-literal
22

33
on:
44
pull_request:
5-
paths:
6-
- "hex-literal/**"
7-
- "Cargo.*"
5+
paths:
6+
- "hex-literal/**"
7+
- "Cargo.*"
88
push:
99
branches: master
1010

@@ -42,14 +42,13 @@ jobs:
4242
with:
4343
toolchain: ${{ matrix.rust }}
4444
targets: ${{ matrix.target }}
45-
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
46-
- run: rm ../Cargo.toml
4745
- run: cargo build --target ${{ matrix.target }}
4846

49-
minimal-versions:
50-
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
51-
with:
52-
working-directory: ${{ github.workflow }}
47+
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
48+
# minimal-versions:
49+
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
50+
# with:
51+
# working-directory: ${{ github.workflow }}
5352

5453
test:
5554
runs-on: ubuntu-latest
@@ -64,6 +63,4 @@ jobs:
6463
- uses: dtolnay/rust-toolchain@master
6564
with:
6665
toolchain: ${{ matrix.rust }}
67-
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
68-
- run: rm ../Cargo.toml
6966
- run: cargo test

.github/workflows/inout.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: inout
22

33
on:
44
pull_request:
5-
paths:
6-
- "inout/**"
7-
- "Cargo.*"
5+
paths:
6+
- "inout/**"
7+
- "Cargo.*"
88
push:
99
branches: master
1010

@@ -45,10 +45,11 @@ jobs:
4545
- run: cargo build --target ${{ matrix.target }}
4646
- run: cargo build --features block-padding --target ${{ matrix.target }}
4747

48-
minimal-versions:
49-
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
50-
with:
51-
working-directory: ${{ github.workflow }}
48+
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
49+
# minimal-versions:
50+
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
51+
# with:
52+
# working-directory: ${{ github.workflow }}
5253

5354
test:
5455
runs-on: ubuntu-latest

.github/workflows/opaque-debug.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: opaque-debug
22

33
on:
44
pull_request:
5-
paths:
6-
- "opaque-debug/**"
7-
- "Cargo.*"
5+
paths:
6+
- "opaque-debug/**"
7+
- "Cargo.*"
88
push:
99
branches: master
1010

@@ -42,15 +42,8 @@ jobs:
4242
with:
4343
toolchain: ${{ matrix.rust }}
4444
targets: ${{ matrix.target }}
45-
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
46-
- run: rm ../Cargo.toml
4745
- run: cargo build --target ${{ matrix.target }}
4846

49-
minimal-versions:
50-
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
51-
with:
52-
working-directory: ${{ github.workflow }}
53-
5447
test:
5548
runs-on: ubuntu-latest
5649
strategy:
@@ -64,6 +57,4 @@ jobs:
6457
- uses: dtolnay/rust-toolchain@master
6558
with:
6659
toolchain: ${{ matrix.rust }}
67-
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
68-
- run: rm ../Cargo.toml
6960
- run: cargo test

.github/workflows/zeroize.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ jobs:
4646
targets: ${{ matrix.target }}
4747
- run: cargo build --no-default-features --target ${{ matrix.target }}
4848

49-
minimal-versions:
50-
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
51-
with:
52-
working-directory: ${{ github.workflow }}
49+
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
50+
# minimal-versions:
51+
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
52+
# with:
53+
# working-directory: ${{ github.workflow }}
5354

5455
test:
5556
strategy:

0 commit comments

Comments
 (0)