Skip to content

Commit f21bf07

Browse files
bors[bot]crawford
andauthored
Merge #664
664: Pin clippy to minimum supported Rust version r=Dirbaio a=crawford Alternate to #657. Builds on #663. The rationale is the same as discussed in 0b0f96e: > It can be rather surprising when new lints pop up when a new stable > toolchain is released. Let's pin this check to a specific version to > avoid those surprises. In deciding which version of clippy to use, I went with the MSRV since that's what's been done historically. The other option was to read from the repo a version number specifically for clippy, but I was afraid that adding one more version number to juggle would increase the odds that it would be forgotten and fall out of sync. Note that this approach uses rustup to install the toolchain dynamically rather than making use of an action. The advantage of this method is that it allows a single pull request to contain the version bump and suggested code changes (this is due to the fact that actions-rs/clippy-check requires a GitHub API token with write permission, but a token of this type is only available when triggering on `pull_request_target` which runs the action using the configuration from the base of the pull request rather than the merge commit). The disadvantage of this approach is that the toolchain setup can no longer be cached by the underlying layering mechanism used by GitHub actions (unlikely to significantly affect this project). Co-authored-by: Alex Crawford <smoltcp@code.acrawford.com>
2 parents bd68588 + 8153a76 commit f21bf07

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.github/workflows/clippy.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ name: Clippy check
77
jobs:
88
clippy:
99
runs-on: ubuntu-latest
10-
env:
11-
RUSTUP_TOOLCHAIN: stable
1210
permissions:
1311
checks: write
1412
steps:
@@ -18,6 +16,9 @@ jobs:
1816
ref: refs/pull/${{ github.event.number }}/head
1917
- uses: actions/checkout@v2
2018
if: github.event_name != 'pull_request_target'
19+
- run: sed -n 's,^rust-version = "\(.*\)"$,RUSTUP_TOOLCHAIN=\1,p' Cargo.toml >> $GITHUB_ENV
20+
- run: rustup toolchain install $RUSTUP_TOOLCHAIN
21+
- run: rustup component add clippy
2122
- uses: actions-rs/clippy-check@v1
2223
with:
2324
token: ${{ secrets.GITHUB_TOKEN }}

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "smoltcp"
33
version = "0.8.0"
44
edition = "2018"
5+
rust-version = "1.60"
56
authors = ["whitequark <whitequark@whitequark.org>"]
67
description = "A TCP/IP stack designed for bare-metal, real-time systems without a heap."
78
documentation = "https://docs.rs/smoltcp/"

0 commit comments

Comments
 (0)