From 3814ec5b16c3ad7f1a37099b3a89644defee4fdf Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 29 Jan 2025 15:23:09 -0700 Subject: Collect directly into ThinVec --- src/librustdoc/clean/utils.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/librustdoc/clean/utils.rs') diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 80dc6b7250c..b0928aa276d 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -81,11 +81,11 @@ pub(crate) fn clean_middle_generic_args<'tcx>( args: ty::Binder<'tcx, &'tcx [ty::GenericArg<'tcx>]>, mut has_self: bool, owner: DefId, -) -> Vec { +) -> ThinVec { let (args, bound_vars) = (args.skip_binder(), args.bound_vars()); if args.is_empty() { // Fast path which avoids executing the query `generics_of`. - return Vec::new(); + return ThinVec::new(); } // If the container is a trait object type, the arguments won't contain the self type but the @@ -144,7 +144,7 @@ pub(crate) fn clean_middle_generic_args<'tcx>( }; let offset = if has_self { 1 } else { 0 }; - let mut clean_args = Vec::with_capacity(args.len().saturating_sub(offset)); + let mut clean_args = ThinVec::with_capacity(args.len().saturating_sub(offset)); clean_args.extend(args.iter().enumerate().rev().filter_map(clean_arg)); clean_args.reverse(); clean_args -- cgit 1.4.1-3-g733a5