diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-01-30 14:58:23 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-02-21 11:51:56 +1100 |
| commit | 912b82500276bae6c1bbef2028b836edbf5ca9eb (patch) | |
| tree | 31f0d8f64d3cf5f172348df5fef5d7e93568a3c8 /compiler/rustc_parse/src | |
| parent | 1807027248f57d98a1490bfbe9eb3d3de944e60f (diff) | |
| download | rust-912b82500276bae6c1bbef2028b836edbf5ca9eb.tar.gz rust-912b82500276bae6c1bbef2028b836edbf5ca9eb.zip | |
Use `ThinVec` in `ast::PatKind::Struct`.
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/pat.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 54fbd36ab28..94f7031fad2 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -23,7 +23,7 @@ use rustc_errors::{ use rustc_session::errors::ExprParenthesesNeeded; use rustc_span::source_map::{respan, Span, Spanned}; use rustc_span::symbol::{kw, sym, Ident}; -use thin_vec::thin_vec; +use thin_vec::{thin_vec, ThinVec}; #[derive(PartialEq, Copy, Clone)] pub enum Expected { @@ -854,7 +854,7 @@ impl<'a> Parser<'a> { e.span_label(path.span, "while parsing the fields for this pattern"); e.emit(); self.recover_stmt(); - (vec![], true) + (ThinVec::new(), true) }); self.bump(); Ok(PatKind::Struct(qself, path, fields, etc)) @@ -933,8 +933,8 @@ impl<'a> Parser<'a> { } /// Parses the fields of a struct-like pattern. - fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<PatField>, bool)> { - let mut fields = Vec::new(); + fn parse_pat_fields(&mut self) -> PResult<'a, (ThinVec<PatField>, bool)> { + let mut fields = ThinVec::new(); let mut etc = false; let mut ate_comma = true; let mut delayed_err: Option<DiagnosticBuilder<'a, ErrorGuaranteed>> = None; |
