Skip to content

Commit

Permalink
Merge pull request #1578 from dtolnay/elseblock
Browse files Browse the repository at this point in the history
Fix error message on unexpected token after 'else'
  • Loading branch information
dtolnay authored Jan 4, 2024
2 parents e8a5c68 + 82fcefc commit dc40084
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/expr.rs
Original file line number Diff line number Diff line change
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

0 comments on commit dc40084

Please sign in to comment.