rust-lang / rust-lang/rust-clippy
Lints from any project are used in all projects in multi-project workspace
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
When working in a workspace, lints enabled in one subproject get applied in all projects, even if they themselves do not enable the lints.
Reproduce
Workspace structure:
Root
+--- homelander/
+--- TestModule/
+--- Cargo.toml
Workspace Cargo.toml:
[workspace]
members = [
"homelander",
"TestModule"
]
Lint in test_module:
#![warn(clippy::cargo)]
No lints are specified in test_module.
When running cargo clippy from the root of the workspace, the bug occurs.
I expected to see this happen
Clippy does not apply lints in one project to all projects in a workspace
Instead, this happened:
Clippy applies lints enabled in one project to all projects
warning: package `test_module` is missing `package.description` metadata
|
note: the lint level is defined here
--> homelander/src/main.rs:7:9
|
7 | #![warn(clippy::cargo)]
| ^^^^^^^^^^^^^
= note: `#[warn(clippy::cargo_common_metadata)]` implied by `#[warn(clippy::cargo)]`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata
warning: package `test_module` is missing `either package.license or package.license_file` metadata
Meta
cargo clippy -V:clippy 0.1.52 (9bc8c42 2021-05-09)rustc -Vv:
rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: x86_64-unknown-linux-gnu
release: 1.52.1
LLVM version: 12.0.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the workspace Cargo.toml and the cargo clippy invocation, then trace how the lint attribute in homelander/src/main.rs is applied across workspace members. Reproduce the reported warnings and verify that each project only receives lints enabled for that project.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100