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.
This commit is contained in:
parent
0cc4f4f7b8
commit
e90f129adf
3 changed files with 8 additions and 8 deletions
|
@ -2254,8 +2254,8 @@ impl GenericArg {
|
|||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||
pub(crate) enum GenericArgs {
|
||||
AngleBracketed { args: Box<[GenericArg]>, constraints: ThinVec<AssocItemConstraint> },
|
||||
Parenthesized { inputs: Box<[Type]>, output: Option<Box<Type>> },
|
||||
AngleBracketed { args: ThinVec<GenericArg>, constraints: ThinVec<AssocItemConstraint> },
|
||||
Parenthesized { inputs: ThinVec<Type>, output: Option<Box<Type>> },
|
||||
}
|
||||
|
||||
impl GenericArgs {
|
||||
|
@ -2279,7 +2279,7 @@ impl GenericArgs {
|
|||
assoc: PathSegment {
|
||||
name: sym::Output,
|
||||
args: GenericArgs::AngleBracketed {
|
||||
args: Vec::new().into_boxed_slice(),
|
||||
args: ThinVec::new(),
|
||||
constraints: ThinVec::new(),
|
||||
},
|
||||
},
|
||||
|
@ -2596,12 +2596,12 @@ mod size_asserts {
|
|||
static_assert_size!(Crate, 56); // frequently moved by-value
|
||||
static_assert_size!(DocFragment, 32);
|
||||
static_assert_size!(GenericArg, 32);
|
||||
static_assert_size!(GenericArgs, 32);
|
||||
static_assert_size!(GenericArgs, 24);
|
||||
static_assert_size!(GenericParamDef, 40);
|
||||
static_assert_size!(Generics, 16);
|
||||
static_assert_size!(Item, 48);
|
||||
static_assert_size!(ItemKind, 48);
|
||||
static_assert_size!(PathSegment, 40);
|
||||
static_assert_size!(PathSegment, 32);
|
||||
static_assert_size!(Type, 32);
|
||||
// tidy-alphabetical-end
|
||||
}
|
||||
|
|
|
@ -821,7 +821,7 @@ pub(crate) fn get_function_type_for_search(
|
|||
.map(|name| clean::PathSegment {
|
||||
name: *name,
|
||||
args: clean::GenericArgs::AngleBracketed {
|
||||
args: Vec::new().into_boxed_slice(),
|
||||
args: ThinVec::new(),
|
||||
constraints: ThinVec::new(),
|
||||
},
|
||||
})
|
||||
|
|
|
@ -231,11 +231,11 @@ impl FromClean<clean::GenericArgs> for GenericArgs {
|
|||
use clean::GenericArgs::*;
|
||||
match args {
|
||||
AngleBracketed { args, constraints } => GenericArgs::AngleBracketed {
|
||||
args: args.into_vec().into_json(renderer),
|
||||
args: args.into_json(renderer),
|
||||
constraints: constraints.into_json(renderer),
|
||||
},
|
||||
Parenthesized { inputs, output } => GenericArgs::Parenthesized {
|
||||
inputs: inputs.into_vec().into_json(renderer),
|
||||
inputs: inputs.into_json(renderer),
|
||||
output: output.map(|a| (*a).into_json(renderer)),
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue