Allocate one less vec in parser/expr.rs
This commit is contained in:
parent
5ca6f7d2c3
commit
ea13023b36
1 changed files with 2 additions and 3 deletions
|
@ -1471,9 +1471,8 @@ impl<'a> Parser<'a> {
|
||||||
} else if self.eat(&token::Comma) {
|
} else if self.eat(&token::Comma) {
|
||||||
// Vector with two or more elements.
|
// Vector with two or more elements.
|
||||||
let sep = SeqSep::trailing_allowed(token::Comma);
|
let sep = SeqSep::trailing_allowed(token::Comma);
|
||||||
let (remaining_exprs, _) = self.parse_seq_to_end(close, sep, |p| p.parse_expr())?;
|
let (mut exprs, _) = self.parse_seq_to_end(close, sep, |p| p.parse_expr())?;
|
||||||
let mut exprs = vec![first_expr];
|
exprs.insert(0, first_expr);
|
||||||
exprs.extend(remaining_exprs);
|
|
||||||
ExprKind::Array(exprs)
|
ExprKind::Array(exprs)
|
||||||
} else {
|
} else {
|
||||||
// Vector with one element
|
// Vector with one element
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue