Skip to content

Commit 1c81cd1

Browse files
committed
parser/grammar: Disallow let statements to end with optional semicolon
1 parent 0075075 commit 1c81cd1

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

crates/parser/src/grammar/expressions.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
6767
attributes::outer_attrs(p);
6868

6969
if p.at(T![let]) {
70-
let_stmt(p, m, with_semi);
70+
let_stmt(p, m);
7171
return;
7272
}
7373

@@ -147,8 +147,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
147147
// let _: ! = {};
148148
// let f = #[attr]||{};
149149
// }
150-
fn let_stmt(p: &mut Parser, m: Marker, with_semi: StmtWithSemi) {
151-
assert!(p.at(T![let]));
150+
fn let_stmt(p: &mut Parser, m: Marker) {
152151
p.bump(T![let]);
153152
patterns::pattern(p);
154153
if p.at(T![:]) {
@@ -157,18 +156,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) {
157156
if p.eat(T![=]) {
158157
expressions::expr_with_attrs(p);
159158
}
160-
161-
match with_semi {
162-
StmtWithSemi::Yes => {
163-
p.expect(T![;]);
164-
}
165-
StmtWithSemi::No => {}
166-
StmtWithSemi::Optional => {
167-
if p.at(T![;]) {
168-
p.eat(T![;]);
169-
}
170-
}
171-
}
159+
p.expect(T![;]);
172160
m.complete(p, LET_STMT);
173161
}
174162
}

0 commit comments

Comments
 (0)