mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Require semi after exprs
This commit is contained in:
parent
a80c07bdff
commit
367e523442
4 changed files with 70 additions and 14 deletions
|
@ -51,10 +51,15 @@ pub(crate) fn block(p: &mut Parser) {
|
|||
// fn foo() { pub 92; } //FIXME
|
||||
items::MaybeItem::None => {
|
||||
let is_blocklike = expressions::expr_stmt(p) == BlockLike::Block;
|
||||
if p.eat(SEMI) || (is_blocklike && !p.at(R_CURLY)) {
|
||||
m.complete(p, EXPR_STMT);
|
||||
} else {
|
||||
if p.at(R_CURLY) {
|
||||
m.abandon(p);
|
||||
} else {
|
||||
if is_blocklike {
|
||||
p.eat(SEMI);
|
||||
} else {
|
||||
p.expect(SEMI);
|
||||
}
|
||||
m.complete(p, EXPR_STMT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue