mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
Merge pull request #2419 from phansch/fix_doc_comment_false_positive
Fix false positive in empty_line_after_outer_attr
This commit is contained in:
@@ -262,6 +262,9 @@ fn check_attrs(cx: &LateContext, span: Span, name: &Name, attrs: &[Attribute]) {
|
||||
}
|
||||
|
||||
for attr in attrs {
|
||||
if attr.is_sugared_doc {
|
||||
return;
|
||||
}
|
||||
if attr.style == AttrStyle::Outer {
|
||||
if !is_present_in_source(cx, attr.span) {
|
||||
return;
|
||||
@@ -276,7 +279,7 @@ fn check_attrs(cx: &LateContext, span: Span, name: &Name, attrs: &[Attribute]) {
|
||||
cx,
|
||||
EMPTY_LINE_AFTER_OUTER_ATTR,
|
||||
attr_to_item_span,
|
||||
&format!("Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute?")
|
||||
"Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute?"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,11 @@ struct Foo {
|
||||
mod foo {
|
||||
}
|
||||
|
||||
/// This doc comment should not produce a warning
|
||||
|
||||
/** This is also a doc comment and should not produce a warning
|
||||
*/
|
||||
|
||||
// This should not produce a warning
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(missing_docs)]
|
||||
|
||||
Reference in New Issue
Block a user