about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2023-02-16 11:40:21 +0530
committerGitHub <noreply@github.com>2023-02-16 11:40:21 +0530
commitef0b12189ee7c0ef8d9ab976a6078f585411c37e (patch)
treecab7c598ee7240b541047c382424a3ebb8ce315b
parent323e5e823bfd7e7a771ca90f9fe9359e34129896 (diff)
parente087f61075814ae2612193f98a84c7f77101f90f (diff)
downloadrust-ef0b12189ee7c0ef8d9ab976a6078f585411c37e.tar.gz
rust-ef0b12189ee7c0ef8d9ab976a6078f585411c37e.zip
Rollup merge of #108101 - matthiaskrgr:noclonecopy, r=compiler-errors
don't clone types that are copy
-rw-r--r--compiler/rustc_hir_typeck/src/method/probe.rs3
-rw-r--r--compiler/rustc_query_system/src/query/caches.rs6
-rw-r--r--compiler/rustc_trait_selection/src/solve/mod.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/object_safety.rs2
4 files changed, 6 insertions, 7 deletions
diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs
index 287a5bf0067..a35fa008a95 100644
--- a/compiler/rustc_hir_typeck/src/method/probe.rs
+++ b/compiler/rustc_hir_typeck/src/method/probe.rs
@@ -517,8 +517,7 @@ fn method_autoderef_steps<'tcx>(
         .by_ref()
         .map(|(ty, d)| {
             let step = CandidateStep {
-                self_ty: infcx
-                    .make_query_response_ignoring_pending_obligations(inference_vars.clone(), ty),
+                self_ty: infcx.make_query_response_ignoring_pending_obligations(inference_vars, ty),
                 autoderefs: d,
                 from_unsafe_deref: reached_raw_pointer,
                 unsize: false,
diff --git a/compiler/rustc_query_system/src/query/caches.rs b/compiler/rustc_query_system/src/query/caches.rs
index c9dd75e4d55..81c7e4673d4 100644
--- a/compiler/rustc_query_system/src/query/caches.rs
+++ b/compiler/rustc_query_system/src/query/caches.rs
@@ -92,7 +92,7 @@ where
         let mut lock = self.cache.lock();
         // We may be overwriting another value. This is all right, since the dep-graph
         // will check that the fingerprint matches.
-        lock.insert(key, (value.clone(), index));
+        lock.insert(key, (value, index));
         value
     }
 
@@ -153,7 +153,7 @@ where
 
     #[inline]
     fn complete(&self, _key: (), value: V, index: DepNodeIndex) -> Self::Stored {
-        *self.cache.lock() = Some((value.clone(), index));
+        *self.cache.lock() = Some((value, index));
         value
     }
 
@@ -283,7 +283,7 @@ where
         let mut lock = self.cache.get_shard_by_hash(key.index() as u64).lock();
         #[cfg(not(parallel_compiler))]
         let mut lock = self.cache.lock();
-        lock.insert(key, (value.clone(), index));
+        lock.insert(key, (value, index));
         value
     }
 
diff --git a/compiler/rustc_trait_selection/src/solve/mod.rs b/compiler/rustc_trait_selection/src/solve/mod.rs
index 301eb4d95f8..28aa3d52705 100644
--- a/compiler/rustc_trait_selection/src/solve/mod.rs
+++ b/compiler/rustc_trait_selection/src/solve/mod.rs
@@ -547,7 +547,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
             response.value.certainty == Certainty::Yes
                 && response.has_no_inference_or_external_constraints()
         }) {
-            return Ok(response.clone());
+            return Ok(*response);
         }
 
         let certainty = candidates.iter().fold(Certainty::AMBIGUOUS, |certainty, response| {
diff --git a/compiler/rustc_trait_selection/src/traits/object_safety.rs b/compiler/rustc_trait_selection/src/traits/object_safety.rs
index c12ba103c34..7ef39b20107 100644
--- a/compiler/rustc_trait_selection/src/traits/object_safety.rs
+++ b/compiler/rustc_trait_selection/src/traits/object_safety.rs
@@ -599,7 +599,7 @@ fn virtual_call_violation_for_method<'tcx>(
             return false;
         }
 
-        contains_illegal_self_type_reference(tcx, trait_def_id, pred.clone())
+        contains_illegal_self_type_reference(tcx, trait_def_id, pred)
     }) {
         return Some(MethodViolationCode::WhereClauseReferencesSelf);
     }