Skip to content

Commit e699ce0

Browse files
Auto merge of #147491 - lolbinarycat:rustdoc-synthesize_auto_trait_impls-no-clone, r=<try>
rustdoc: remove redundant clone in synthesize_auto_trait_impls
2 parents 7a52736 + b7b61a5 commit e699ce0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustdoc/clean/auto_trait.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ pub(crate) fn synthesize_auto_trait_impls<'tcx>(
2525
let ty = tcx.type_of(item_def_id).instantiate_identity();
2626

2727
let finder = auto_trait::AutoTraitFinder::new(tcx);
28-
let mut auto_trait_impls: Vec<_> = cx
29-
.auto_traits
30-
.clone()
31-
.into_iter()
32-
.filter_map(|trait_def_id| {
28+
let auto_traits = std::mem::take(&mut cx.auto_traits);
29+
let mut auto_trait_impls: Vec<_> = auto_traits
30+
.iter()
31+
.filter_map(|&trait_def_id| {
3332
synthesize_auto_trait_impl(
3433
cx,
3534
ty,
@@ -41,6 +40,7 @@ pub(crate) fn synthesize_auto_trait_impls<'tcx>(
4140
)
4241
})
4342
.collect();
43+
cx.auto_traits = auto_traits;
4444
// We are only interested in case the type *doesn't* implement the `Sized` trait.
4545
if !ty.is_sized(tcx, typing_env)
4646
&& let Some(sized_trait_def_id) = tcx.lang_items().sized_trait()

0 commit comments

Comments
 (0)