Skip to content

Commit

Permalink
Avoid removing elements from the beginning of a vec (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored May 25, 2023
1 parent d23611d commit 5493c9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions parser/src/python.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ ExpressionStatement: ast::Stmt = {
let mut targets = vec![set_context(expression, ast::ExprContext::Store)];
let mut values = suffix;

while values.len() > 1 {
targets.push(set_context(values.remove(0), ast::ExprContext::Store));
}
let value = Box::new(values.pop().unwrap());

let value = Box::new(values.into_iter().next().unwrap());
for target in values {
targets.push(set_context(target, ast::ExprContext::Store));
}

ast::Stmt::Assign(
ast::StmtAssign { targets, value, type_comment: None, range: (location..end_location).into() }
Expand Down
10 changes: 5 additions & 5 deletions parser/src/python.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5493c9f

Please sign in to comment.