rust-lang / rust-lang/rust-clippy
`cargo clippy --all-targets` issues diagnostics for library crate twice
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Given a crate containing this file as src/lib.rs
pub fn demo() -> &'static str {
return "demo";
}
and at least one file in tests that does use name_of_crate::demo, cargo clippy --all-targets will diagnose the needless_return twice in a row. If you use cargo --verbose it's clear that the clippy-driver program has been invoked twice (once with --test and once without) and each invocation is reporting the lint, but without that, it looks like clippy is repeating itself for no reason.
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 with the shown src/lib.rs and a file under tests that imports demo, then run cargo clippy --all-targets and compare it with cargo --verbose. Trace the two clippy-driver invocations, one with --test and one without; done means the needless_return diagnostic is reported only once.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100