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

Fix missing_docs_in_private_items false negative #7281

Merged
merged 1 commit into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clippy_lints/src/missing_doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ impl MissingDoc {
return;
}

let has_doc = attrs.iter().any(|a| {
a.is_doc_comment() || a.doc_str().is_some() || a.value_str().is_some() || Self::has_include(a.meta())
});
let has_doc = attrs
.iter()
.any(|a| a.doc_str().is_some() || Self::has_include(a.meta()));
if !has_doc {
span_lint(
cx,
Expand Down
5 changes: 4 additions & 1 deletion tests/ui/missing-doc-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ impl PubFoo {
pub fn foo() {}
/// dox
pub fn foo1() {}
fn foo2() {}
#[must_use = "yep"]
fn foo2() -> u32 {
1
}
#[allow(clippy::missing_docs_in_private_items)]
pub fn foo3() {}
}
Expand Down
8 changes: 5 additions & 3 deletions tests/ui/missing-doc-impl.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ LL | pub fn foo() {}
| ^^^^^^^^^^^^^^^

error: missing documentation for an associated function
--> $DIR/missing-doc-impl.rs:70:5
--> $DIR/missing-doc-impl.rs:71:5
|
LL | fn foo2() {}
| ^^^^^^^^^^^^
LL | / fn foo2() -> u32 {
LL | | 1
LL | | }
| |_____^

error: aborting due to 15 previous errors