diff options
| author | bors <bors@rust-lang.org> | 2025-02-06 00:53:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-06 00:53:53 +0000 |
| commit | 30865107cb8942ab8eaf9baf8d3aa2a6dec2643f (patch) | |
| tree | c3c1df2220cd8bc860cc3b59e27f696becb6ea25 /src/librustdoc/clean/utils.rs | |
| parent | 6741521dc478182392806e816e919a36be5a2ba2 (diff) | |
| parent | 3814ec5b16c3ad7f1a37099b3a89644defee4fdf (diff) | |
| download | rust-30865107cb8942ab8eaf9baf8d3aa2a6dec2643f.tar.gz rust-30865107cb8942ab8eaf9baf8d3aa2a6dec2643f.zip | |
Auto merge of #136265 - notriddle:notriddle/clean-up, r=fmease
rustdoc: use ThinVec for generic arg parts This reduces the size of both these args, and of path segments, so should measurably help with memory use.
Diffstat (limited to 'src/librustdoc/clean/utils.rs')
| -rw-r--r-- | src/librustdoc/clean/utils.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index f1921b90cc6..8a7d140bb1a 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<GenericArg> { +) -> ThinVec<GenericArg> { 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 |
