Open
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