diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-11-22 09:17:20 +1100 | 
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-02-21 11:51:55 +1100 | 
| commit | dd7aff5cc5d3eba6dd0301ba6b33d3e178f91614 (patch) | |
| tree | 3949df9e4d08f2c0eb293926d60bfeb304f199d7 /compiler/rustc_parse/src/parser/generics.rs | |
| parent | 06228d6e9331dd7742e069287bbb4802663b2742 (diff) | |
| download | rust-dd7aff5cc5d3eba6dd0301ba6b33d3e178f91614.tar.gz rust-dd7aff5cc5d3eba6dd0301ba6b33d3e178f91614.zip | |
Use `ThinVec` in `ast::Generics` and related types.
Diffstat (limited to 'compiler/rustc_parse/src/parser/generics.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/generics.rs | 7 | 
1 files changed, 4 insertions, 3 deletions
| diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index 23f49ec55a1..0eaa029a20d 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -14,6 +14,7 @@ use rustc_ast::{ use rustc_errors::{Applicability, PResult}; use rustc_span::symbol::{kw, Ident}; use rustc_span::Span; +use thin_vec::ThinVec; enum PredicateOrStructBody { Predicate(ast::WherePredicate), @@ -121,8 +122,8 @@ impl<'a> Parser<'a> { /// Parses a (possibly empty) list of lifetime and type parameters, possibly including /// a trailing comma and erroneous trailing attributes. - pub(super) fn parse_generic_params(&mut self) -> PResult<'a, Vec<ast::GenericParam>> { - let mut params = Vec::new(); + pub(super) fn parse_generic_params(&mut self) -> PResult<'a, ThinVec<ast::GenericParam>> { + let mut params = ThinVec::new(); let mut done = false; while !done { let attrs = self.parse_outer_attributes()?; @@ -251,7 +252,7 @@ impl<'a> Parser<'a> { self.expect_gt()?; (params, span_lo.to(self.prev_token.span)) } else { - (vec![], self.prev_token.span.shrink_to_hi()) + (ThinVec::new(), self.prev_token.span.shrink_to_hi()) }; Ok(ast::Generics { params, | 
