Use ThinVec in ast::Generics and related types.

This commit is contained in:
Nicholas Nethercote 2022-11-22 09:17:20 +11:00
parent 06228d6e93
commit dd7aff5cc5
12 changed files with 97 additions and 97 deletions

View file

@ -177,7 +177,7 @@ use std::cell::RefCell;
use std::iter;
use std::ops::Not;
use std::vec;
use thin_vec::thin_vec;
use thin_vec::{thin_vec, ThinVec};
use ty::{Bounds, Path, Ref, Self_, Ty};
pub mod ty;
@ -318,7 +318,7 @@ pub fn combine_substructure(
}
struct TypeParameter {
bound_generic_params: Vec<ast::GenericParam>,
bound_generic_params: ThinVec<ast::GenericParam>,
ty: P<ast::Ty>,
}
@ -385,7 +385,7 @@ fn find_type_parameters(
struct Visitor<'a, 'b> {
cx: &'a ExtCtxt<'b>,
ty_param_names: &'a [Symbol],
bound_generic_params_stack: Vec<ast::GenericParam>,
bound_generic_params_stack: ThinVec<ast::GenericParam>,
type_params: Vec<TypeParameter>,
}
@ -422,7 +422,7 @@ fn find_type_parameters(
let mut visitor = Visitor {
cx,
ty_param_names,
bound_generic_params_stack: Vec::new(),
bound_generic_params_stack: ThinVec::new(),
type_params: Vec::new(),
};
visit::Visitor::visit_ty(&mut visitor, ty);
@ -594,7 +594,7 @@ impl<'a> TraitDef<'a> {
let span = generics.span.with_ctxt(ctxt);
// Create the generic parameters
let params: Vec<_> = generics
let params: ThinVec<_> = generics
.params
.iter()
.map(|param| match &param.kind {