rust-lang / rust-lang/rust-clippy
clippy::cargo lint is applied to sibling crates
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
When #[warn(clippy::cargo)] is enabled in one crate in a workspace, warnings are emitted for other crates in the same workspace too.
Reproducer
I tried this code:
.
├── a
│ ├── Cargo.toml
│ └── src
│ └── main.rs
├── b
│ ├── Cargo.toml
│ └── src
│ └── main.rs
├── Cargo.lock
└── Cargo.toml
a/src/main.rs:
#![warn(clippy::cargo)]
fn main() {
println!("Hello, world!");
}
b/src/main.rs:
fn main() {
println!("Hello, world!");
}
I expected to see this happen: cargo clippy emits warnings for a but not b
Instead, this happened: cargo clippy emits warnings for both a and b
Version
rustc 1.84.0-nightly (1e4f10ba6 2024-10-29)
binary: rustc
commit-hash: 1e4f10ba6476e48a42a79b9f846a2d9366525b9e
commit-date: 2024-10-29
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1
Additional Labels
No response
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
Reproduce the workspace using a/src/main.rs and b/src/main.rs, with #[warn(clippy::cargo)] only in crate a, then trace how cargo lint warnings are applied across workspace crates. Done means cargo clippy reports the cargo-lint warnings for a without emitting them for sibling crate b.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100