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 false positive in empty_line_after_outer_attribute #2577

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion clippy_lints/src/attrs.rs
Expand Up @@ -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;
}

Expand Down
12 changes: 12 additions & 0 deletions tests/ui/empty_line_after_outer_attribute.rs
Expand Up @@ -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() { }