diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-01-14 11:44:25 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-01-14 11:44:25 +0000 |
| commit | ea13023b367d56ac3a8fcb72c9bbe636cf9ae1e7 (patch) | |
| tree | d46f5bb2336427693efe1bc4d3c7cb3bcca5666e /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 5ca6f7d2c34953ee360ccf7d3c84c7853ea2df4b (diff) | |
| download | rust-ea13023b367d56ac3a8fcb72c9bbe636cf9ae1e7.tar.gz rust-ea13023b367d56ac3a8fcb72c9bbe636cf9ae1e7.zip | |
Allocate one less vec in `parser/expr.rs`
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index dd2b03988c3..9995b214861 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -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 |
