Merge pull request #2892 from topecongiro/issue-2884

Explicitly handle semicolon after the item in statement position
This commit is contained in:
Nick Cameron 2018-08-06 19:34:44 +12:00 committed by GitHub
commit 8cd6633499
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -90,6 +90,8 @@ fn visit_stmt(&mut self, stmt: &ast::Stmt) {
match stmt.node {
ast::StmtKind::Item(ref item) => {
self.visit_item(item);
// Handle potential `;` after the item.
self.format_missing(stmt.span.hi());
}
ast::StmtKind::Local(..) | ast::StmtKind::Expr(..) | ast::StmtKind::Semi(..) => {
if contains_skip(get_attrs_from_stmt(stmt)) {

View File

@ -60,6 +60,9 @@ fn foo() -> bool {
// Check subformatting
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
}
// #2884
let _ = [0; {struct Foo; impl Foo {const fn get(&self) -> usize {5}}; Foo.get()}];
}
fn bar() {

View File

@ -88,6 +88,17 @@ fn foo() -> bool {
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
}
// #2884
let _ = [0; {
struct Foo;
impl Foo {
const fn get(&self) -> usize {
5
}
};
Foo.get()
}];
}
fn bar() {