rustdoc: Remove unnecessary clone in DocFolder
Also, contrary to the comment, the clone is not that small, since `Variant` contains `Item`s, which are quite large when you factor in both stack- and heap-allocated memory.
This commit is contained in:
parent
c7e4740ec1
commit
537b82cfad
1 changed files with 1 additions and 2 deletions
|
|
@ -47,7 +47,6 @@ crate trait DocFolder: Sized {
|
|||
ImplItem(i)
|
||||
}
|
||||
VariantItem(i) => {
|
||||
let i2 = i.clone(); // this clone is small
|
||||
match i {
|
||||
Variant::Struct(mut j) => {
|
||||
let num_fields = j.fields.len();
|
||||
|
|
@ -60,7 +59,7 @@ crate trait DocFolder: Sized {
|
|||
let fields = fields.into_iter().filter_map(|x| self.fold_item(x)).collect();
|
||||
VariantItem(Variant::Tuple(fields))
|
||||
}
|
||||
_ => VariantItem(i2),
|
||||
i => VariantItem(i),
|
||||
}
|
||||
}
|
||||
x => x,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue