Skip to content

Commit 537b82c

Browse files
committed
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.
1 parent c7e4740 commit 537b82c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/librustdoc/fold.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ crate trait DocFolder: Sized {
4747
ImplItem(i)
4848
}
4949
VariantItem(i) => {
50-
let i2 = i.clone(); // this clone is small
5150
match i {
5251
Variant::Struct(mut j) => {
5352
let num_fields = j.fields.len();
@@ -60,7 +59,7 @@ crate trait DocFolder: Sized {
6059
let fields = fields.into_iter().filter_map(|x| self.fold_item(x)).collect();
6160
VariantItem(Variant::Tuple(fields))
6261
}
63-
_ => VariantItem(i2),
62+
i => VariantItem(i),
6463
}
6564
}
6665
x => x,

0 commit comments

Comments
 (0)