Fix missing_docs_in_private_items FP

This commit is contained in:
Cameron Steffen 2021-05-26 16:13:57 -05:00
parent a248648862
commit c21b965d43
3 changed files with 12 additions and 7 deletions

View file

@ -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,

View file

@ -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() {}
}

View file

@ -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