diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 417ddbe8c12b..38cc40d2e160 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -267,7 +267,7 @@ fn check_attrs(cx: &LateContext, span: Span, name: &Name, attrs: &[Attribute]) { return; } if attr.style == AttrStyle::Outer { - if !is_present_in_source(cx, attr.span) { + if attr.tokens.is_empty() || !is_present_in_source(cx, attr.span) { return; } diff --git a/tests/ui/empty_line_after_outer_attribute.rs b/tests/ui/empty_line_after_outer_attribute.rs index beaa98953da7..16eb95abbcbf 100644 --- a/tests/ui/empty_line_after_outer_attribute.rs +++ b/tests/ui/empty_line_after_outer_attribute.rs @@ -67,4 +67,16 @@ pub fn function() -> bool { true } +// This should not produce a warning +#[derive(Clone, Copy)] +pub enum FooFighter { + Bar1, + + Bar2, + + Bar3, + + Bar4 +} + fn main() { }