From 912b82500276bae6c1bbef2028b836edbf5ca9eb Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 30 Jan 2023 14:58:23 +1100 Subject: Use `ThinVec` in `ast::PatKind::Struct`. --- compiler/rustc_parse/src/parser/pat.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/rustc_parse/src/parser') 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, bool)> { - let mut fields = Vec::new(); + fn parse_pat_fields(&mut self) -> PResult<'a, (ThinVec, bool)> { + let mut fields = ThinVec::new(); let mut etc = false; let mut ate_comma = true; let mut delayed_err: Option> = None; -- cgit 1.4.1-3-g733a5