We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c1b9915 commit 0e5aee1Copy full SHA for 0e5aee1
clippy_lints/src/items_after_statements.rs
@@ -58,12 +58,12 @@ impl EarlyLintPass for ItemsAfterStatements {
58
return;
59
}
60
61
- // skip initial items
+ // skip initial items and trailing semicolons
62
let stmts = item
63
.stmts
64
.iter()
65
.map(|stmt| &stmt.kind)
66
- .skip_while(|s| matches!(**s, StmtKind::Item(..)));
+ .skip_while(|s| matches!(**s, StmtKind::Item(..) | StmtKind::Empty));
67
68
// lint on all further items
69
for stmt in stmts {
tests/ui/item_after_statement.rs
@@ -37,3 +37,16 @@ fn mac() {
37
b!();
38
println!("{}", a);
39
40
+
41
+fn semicolon() {
42
+ struct S {
43
+ a: u32,
44
+ };
45
+ impl S {
46
+ fn new(a: u32) -> Self {
47
+ Self { a }
48
+ }
49
50
51
+ let _ = S::new(3);
52
+}
0 commit comments