Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing_errors_doc warns on test functions when check-private-items = true #13391

Closed
GrantGryczan opened this issue Sep 13, 2024 · 1 comment · Fixed by #13610
Closed

missing_errors_doc warns on test functions when check-private-items = true #13391

GrantGryczan opened this issue Sep 13, 2024 · 1 comment · Fixed by #13610
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@GrantGryczan
Copy link

Summary

When check-private-items = true is set in clippy.toml, missing_errors_doc warnings can appear on test functions, even though there's no reason to document the meanings of errors returned by test functions, since these errors won't used by other code.

Lint Name

missing_errors_doc

Reproducer

I tried this code:

#[warn(clippy::missing_errors_doc)]
#[test]
fn test() -> Result<(), ()> {
    Ok(())
}

I saw this happen:

warning: docs for function returning `Result` missing `# Errors` section
 --> src/main.rs:7:1
  |
7 | fn test() -> Result<(), ()> {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
note: the lint level is defined here
 --> src/main.rs:5:8
  |
5 | #[warn(clippy::missing_errors_doc)]
  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^


I expected to see this happen:

No warning.

Version

rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: x86_64-pc-windows-msvc
release: 1.81.0
LLVM version: 18.1.7

Additional Labels

No response

@GrantGryczan GrantGryczan added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Sep 13, 2024
@alex-semenyuk
Copy link
Member

Don't see this issue at latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
2 participants