Skip to content

Commit f7c4bb6

Browse files
authored
Merge pull request #2577 from phansch/false_positive_empty_line_after_outer_attr_with_enum
Fix false positive in empty_line_after_outer_attribute
2 parents eafd090 + 034c81b commit f7c4bb6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

clippy_lints/src/attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn check_attrs(cx: &LateContext, span: Span, name: &Name, attrs: &[Attribute]) {
267267
return;
268268
}
269269
if attr.style == AttrStyle::Outer {
270-
if !is_present_in_source(cx, attr.span) {
270+
if attr.tokens.is_empty() || !is_present_in_source(cx, attr.span) {
271271
return;
272272
}
273273

tests/ui/empty_line_after_outer_attribute.rs

+12
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,16 @@ pub fn function() -> bool {
6767
true
6868
}
6969

70+
// This should not produce a warning
71+
#[derive(Clone, Copy)]
72+
pub enum FooFighter {
73+
Bar1,
74+
75+
Bar2,
76+
77+
Bar3,
78+
79+
Bar4
80+
}
81+
7082
fn main() { }

0 commit comments

Comments
 (0)