items_after_statements: don't lint when they a separated by trailing semicolons
This commit is contained in:
parent
c1b991588f
commit
0e5aee1fc1
@ -58,12 +58,12 @@ impl EarlyLintPass for ItemsAfterStatements {
|
||||
return;
|
||||
}
|
||||
|
||||
// skip initial items
|
||||
// skip initial items and trailing semicolons
|
||||
let stmts = item
|
||||
.stmts
|
||||
.iter()
|
||||
.map(|stmt| &stmt.kind)
|
||||
.skip_while(|s| matches!(**s, StmtKind::Item(..)));
|
||||
.skip_while(|s| matches!(**s, StmtKind::Item(..) | StmtKind::Empty));
|
||||
|
||||
// lint on all further items
|
||||
for stmt in stmts {
|
||||
|
@ -37,3 +37,16 @@ fn mac() {
|
||||
b!();
|
||||
println!("{}", a);
|
||||
}
|
||||
|
||||
fn semicolon() {
|
||||
struct S {
|
||||
a: u32,
|
||||
};
|
||||
impl S {
|
||||
fn new(a: u32) -> Self {
|
||||
Self { a }
|
||||
}
|
||||
}
|
||||
|
||||
let _ = S::new(3);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user