mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
Allocate one less vec in parser/expr.rs
This commit is contained in:
parent
5ca6f7d2c3
commit
ea13023b36
@ -1471,9 +1471,8 @@ impl<'a> Parser<'a> {
|
||||
} else if self.eat(&token::Comma) {
|
||||
// Vector with two or more elements.
|
||||
let sep = SeqSep::trailing_allowed(token::Comma);
|
||||
let (remaining_exprs, _) = self.parse_seq_to_end(close, sep, |p| p.parse_expr())?;
|
||||
let mut exprs = vec![first_expr];
|
||||
exprs.extend(remaining_exprs);
|
||||
let (mut exprs, _) = self.parse_seq_to_end(close, sep, |p| p.parse_expr())?;
|
||||
exprs.insert(0, first_expr);
|
||||
ExprKind::Array(exprs)
|
||||
} else {
|
||||
// Vector with one element
|
||||
|
Loading…
Reference in New Issue
Block a user