`missing_docs` triggers for integration tests
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Summary
If you warn on missing_docs, every integration test causes a warning from clippy --tests.
I think integration tests should be exempt from missing_docs.
My editor (https://zed.dev) (and maybe rust-analyzer by default?) shows clippy --tests messages too (and not just clippy), so having any integration tests in the tree makes missing_docs practically unusable.
Lint Name
missing_docs
Reproducer
Using the fn add example from cargo init --lib
Add to Cargo.toml
[lints.rust]
missing_docs = "warn"
add new file tests/two_plus_two.rs
use rust_clippy_missing_docs_for_tests::add;
// literally just a copy-paste from the in-library test
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
And now clippy --tests complains:
$ cargo clippy --tests
warning: missing documentation for the crate
--> tests/two_plus_two.rs:1:1
|
1 | / use rust_clippy_missing_docs_for_tests::add;
... |
8 | | assert_eq!(result, 4);
9 | | }
| |_^
|
= note: requested on the command line with `-W missing-docs`
warning: `rust-clippy-missing-docs-for-tests` (test "two_plus_two") generated 1 warning
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
Version
rustc 1.85.0 (4d91de4e4 2025-02-17)
binary: rustc
commit-hash: 4d91de4e48198da2e33413efdcd9cd2cc0c46688
commit-date: 2025-02-17
host: x86_64-unknown-linux-gnu
release: 1.85.0
LLVM version: 19.1.7
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 warning with the Cargo.toml lint setting and tests/two_plus_two.rs, then run cargo clippy --tests. Trace how the missing_docs lint handles integration-test crates; done means the integration test no longer warns while missing documentation elsewhere still does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100