mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
compress
This commit is contained in:
parent
ad4b02ecc0
commit
8234a85d15
2 changed files with 6 additions and 5 deletions
|
@ -59,7 +59,7 @@ pub(crate) mod entry {
|
|||
}
|
||||
|
||||
pub(crate) fn stmt(p: &mut Parser) {
|
||||
expressions::stmt(p, expressions::StmtWithSemi::No, true);
|
||||
expressions::stmt(p, expressions::StmtWithSemi::No);
|
||||
}
|
||||
|
||||
pub(crate) fn pat(p: &mut Parser) {
|
||||
|
@ -103,7 +103,7 @@ pub(crate) mod entry {
|
|||
continue;
|
||||
}
|
||||
|
||||
expressions::stmt(p, expressions::StmtWithSemi::Optional, true);
|
||||
expressions::stmt(p, expressions::StmtWithSemi::Optional);
|
||||
}
|
||||
|
||||
m.complete(p, MACRO_STMTS);
|
||||
|
|
|
@ -5,6 +5,7 @@ use super::*;
|
|||
pub(crate) use self::atom::{block_expr, match_arm_list};
|
||||
pub(super) use self::atom::{literal, LITERAL_FIRST};
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
pub(super) enum StmtWithSemi {
|
||||
Yes,
|
||||
No,
|
||||
|
@ -28,7 +29,7 @@ fn expr_no_struct(p: &mut Parser) {
|
|||
expr_bp(p, None, r, 1);
|
||||
}
|
||||
|
||||
pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi, prefer_expr: bool) {
|
||||
pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
|
||||
let m = p.start();
|
||||
// test attr_on_expr_stmt
|
||||
// fn foo() {
|
||||
|
@ -52,7 +53,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi, prefer_expr: bool) {
|
|||
};
|
||||
|
||||
if let Some((cm, blocklike)) = expr_stmt(p, Some(m)) {
|
||||
if !(p.at(T!['}']) || (prefer_expr && p.at(EOF))) {
|
||||
if !(p.at(T!['}']) || (with_semi != StmtWithSemi::Yes && p.at(EOF))) {
|
||||
// test no_semi_after_block
|
||||
// fn foo() {
|
||||
// if true {}
|
||||
|
@ -149,7 +150,7 @@ pub(super) fn expr_block_contents(p: &mut Parser) {
|
|||
continue;
|
||||
}
|
||||
|
||||
stmt(p, StmtWithSemi::Yes, false);
|
||||
stmt(p, StmtWithSemi::Yes);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue