Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error message on unexpected token after else #1578

Merged
merged 1 commit into from Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/expr.rs
Expand Up @@ -2142,9 +2142,9 @@ pub(crate) mod parsing {
let else_token: Token![else] = input.parse()?;

let lookahead = input.lookahead1();
let else_branch = if input.peek(Token![if]) {
let else_branch = if lookahead.peek(Token![if]) {
input.parse().map(Expr::If)?
} else if input.peek(token::Brace) {
} else if lookahead.peek(token::Brace) {
Expr::Block(ExprBlock {
attrs: Vec::new(),
label: None,
Expand Down