Skip to content

Commit 9db8e6d

Browse files
authored
Rollup merge of #106849 - WaffleLapkin:unvec, r=Nilstrieb
Allocate one less vec while parsing arrays Probably does not matter, but imo a little bit nicer.
2 parents 14fbc21 + ea13023 commit 9db8e6d

File tree

1 file changed

+2
-3
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+2
-3
lines changed

compiler/rustc_parse/src/parser/expr.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1475,9 +1475,8 @@ impl<'a> Parser<'a> {
14751475
} else if self.eat(&token::Comma) {
14761476
// Vector with two or more elements.
14771477
let sep = SeqSep::trailing_allowed(token::Comma);
1478-
let (remaining_exprs, _) = self.parse_seq_to_end(close, sep, |p| p.parse_expr())?;
1479-
let mut exprs = vec![first_expr];
1480-
exprs.extend(remaining_exprs);
1478+
let (mut exprs, _) = self.parse_seq_to_end(close, sep, |p| p.parse_expr())?;
1479+
exprs.insert(0, first_expr);
14811480
ExprKind::Array(exprs)
14821481
} else {
14831482
// Vector with one element

0 commit comments

Comments
 (0)