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:
Noah Lev 2021-10-31 19:58:28 -07:00
parent c7e4740ec1
commit 537b82cfad

View file

@ -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,