about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-09-28 00:20:32 +0200
committerMatthias Krüger <matthias.krueger@famsik.de>2023-09-28 00:20:32 +0200
commite8a33847fd1d92a50d53287c737670d1a8f80df0 (patch)
treeabbab78ec7fded868c9f6152567df477dc5b6ea1
parentfd95627134e85f56f2e162790f56943b407f1a34 (diff)
downloadrust-e8a33847fd1d92a50d53287c737670d1a8f80df0.tar.gz
rust-e8a33847fd1d92a50d53287c737670d1a8f80df0.zip
don't clone copy types
-rw-r--r--compiler/rustc_hir_analysis/src/collect.rs2
-rw-r--r--compiler/stable_mir/src/fold.rs4
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
index cd37221ae6f..221df4e36b2 100644
--- a/compiler/rustc_hir_analysis/src/collect.rs
+++ b/compiler/rustc_hir_analysis/src/collect.rs
@@ -1374,7 +1374,7 @@ fn impl_trait_ref(
                 // make astconv happy.
                 let mut path_segments = ast_trait_ref.path.segments.to_vec();
                 let last_segment = path_segments.len() - 1;
-                let mut args = path_segments[last_segment].args().clone();
+                let mut args = *path_segments[last_segment].args();
                 let last_arg = args.args.len() - 1;
                 assert!(matches!(args.args[last_arg], hir::GenericArg::Const(anon_const) if tcx.has_attr(anon_const.value.def_id, sym::rustc_host)));
                 args.args = &args.args[..args.args.len() - 1];
diff --git a/compiler/stable_mir/src/fold.rs b/compiler/stable_mir/src/fold.rs
index 16ae62311aa..1da123e922b 100644
--- a/compiler/stable_mir/src/fold.rs
+++ b/compiler/stable_mir/src/fold.rs
@@ -81,7 +81,7 @@ impl Foldable for UnevaluatedConst {
 
 impl Foldable for ConstDef {
     fn super_fold<V: Folder>(&self, _folder: &mut V) -> ControlFlow<V::Break, Self> {
-        ControlFlow::Continue(self.clone())
+        ControlFlow::Continue(*self)
     }
 }
 
@@ -96,7 +96,7 @@ impl<T: Foldable> Foldable for Option<T> {
 
 impl Foldable for Promoted {
     fn super_fold<V: Folder>(&self, _folder: &mut V) -> ControlFlow<V::Break, Self> {
-        ControlFlow::Continue(self.clone())
+        ControlFlow::Continue(*self)
     }
 }