Skip to content

Commit ef0b121

Browse files
authored
Rollup merge of #108101 - matthiaskrgr:noclonecopy, r=compiler-errors
don't clone types that are copy
2 parents 323e5e8 + e087f61 commit ef0b121

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,7 @@ fn method_autoderef_steps<'tcx>(
517517
.by_ref()
518518
.map(|(ty, d)| {
519519
let step = CandidateStep {
520-
self_ty: infcx
521-
.make_query_response_ignoring_pending_obligations(inference_vars.clone(), ty),
520+
self_ty: infcx.make_query_response_ignoring_pending_obligations(inference_vars, ty),
522521
autoderefs: d,
523522
from_unsafe_deref: reached_raw_pointer,
524523
unsize: false,

compiler/rustc_query_system/src/query/caches.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ where
9292
let mut lock = self.cache.lock();
9393
// We may be overwriting another value. This is all right, since the dep-graph
9494
// will check that the fingerprint matches.
95-
lock.insert(key, (value.clone(), index));
95+
lock.insert(key, (value, index));
9696
value
9797
}
9898

@@ -153,7 +153,7 @@ where
153153

154154
#[inline]
155155
fn complete(&self, _key: (), value: V, index: DepNodeIndex) -> Self::Stored {
156-
*self.cache.lock() = Some((value.clone(), index));
156+
*self.cache.lock() = Some((value, index));
157157
value
158158
}
159159

@@ -283,7 +283,7 @@ where
283283
let mut lock = self.cache.get_shard_by_hash(key.index() as u64).lock();
284284
#[cfg(not(parallel_compiler))]
285285
let mut lock = self.cache.lock();
286-
lock.insert(key, (value.clone(), index));
286+
lock.insert(key, (value, index));
287287
value
288288
}
289289

compiler/rustc_trait_selection/src/solve/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
547547
response.value.certainty == Certainty::Yes
548548
&& response.has_no_inference_or_external_constraints()
549549
}) {
550-
return Ok(response.clone());
550+
return Ok(*response);
551551
}
552552

553553
let certainty = candidates.iter().fold(Certainty::AMBIGUOUS, |certainty, response| {

compiler/rustc_trait_selection/src/traits/object_safety.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ fn virtual_call_violation_for_method<'tcx>(
599599
return false;
600600
}
601601

602-
contains_illegal_self_type_reference(tcx, trait_def_id, pred.clone())
602+
contains_illegal_self_type_reference(tcx, trait_def_id, pred)
603603
}) {
604604
return Some(MethodViolationCode::WhereClauseReferencesSelf);
605605
}

0 commit comments

Comments
 (0)