Skip to content

Commit cf287d9

Browse files
committed
Avoid removing elements from the beginning of a vec
1 parent 3654cf0 commit cf287d9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

parser/src/python.lalrpop

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ ExpressionStatement: ast::Stmt = {
9090
let mut targets = vec![set_context(expression, ast::ExprContext::Store)];
9191
let mut values = suffix;
9292

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

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

9999
ast::Stmt::Assign(
100100
ast::StmtAssign { targets, value, type_comment: None, range: (location..end_location).into() }

parser/src/python.rs

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)