Skip to content

Commit 2f84e1a

Browse files
committed
Auto merge of #11722 - Muscraft:add-clippy-lints, r=epage
Add clippy lints It was discussed in a recent cargo team meeting that it would be okay to allow specific `clippy` lints to be `warn`/`deny` within cargo. This PR adds a CI job that denies `clippy` warnings for cargo's `lib`. As well as sets [`clippy::self_named_module_files`](https://rust-lang.github.io/rust-clippy/master/index.html#self_named_module_files) to be a warning. [`clippy::self_named_module_files`](https://rust-lang.github.io/rust-clippy/master/index.html#self_named_module_files): "Checks that module layout uses only `mod.rs` files". This allows cargo's structure to be consistent and enforced across the board.
2 parents 25b8771 + d7d27cd commit 2f84e1a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ jobs:
2828
cargo fmt --all --manifest-path $manifest --check
2929
done
3030
31+
# Ensure there are no clippy warnings
32+
clippy:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v3
36+
- run: rustup update stable && rustup default stable
37+
- run: rustup component add clippy
38+
# Only check cargo lib for now
39+
- run: cargo clippy -p cargo --lib -- -D warnings
40+
3141
test:
3242
runs-on: ${{ matrix.os }}
3343
env:

src/cargo/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Due to some of the default clippy lints being somewhat subjective and not
55
// necessarily an improvement, we prefer to not use them at this time.
66
#![allow(clippy::all)]
7+
#![warn(clippy::self_named_module_files)]
78
#![allow(rustdoc::private_intra_doc_links)]
89

910
//! # Cargo as a library

0 commit comments

Comments
 (0)