don't clone types that are Copy (clippy::clone_on_copy)
This commit is contained in:
parent
22719efcc5
commit
c1e96085d3
15 changed files with 30 additions and 34 deletions
|
@ -249,10 +249,10 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
if let ObligationCauseCode::WellFormed(Some(wf_loc)) =
|
||||
root_obligation.cause.code.peel_derives()
|
||||
{
|
||||
if let Some(cause) = self.tcx.diagnostic_hir_wf_check((
|
||||
tcx.erase_regions(obligation.predicate),
|
||||
wf_loc.clone(),
|
||||
)) {
|
||||
if let Some(cause) = self
|
||||
.tcx
|
||||
.diagnostic_hir_wf_check((tcx.erase_regions(obligation.predicate), *wf_loc))
|
||||
{
|
||||
obligation.cause = cause;
|
||||
span = obligation.cause.span;
|
||||
}
|
||||
|
|
|
@ -595,7 +595,7 @@ impl TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
|
|||
ty::ReLateBound(debruijn, br) if debruijn >= self.current_index => {
|
||||
let universe = self.universe_for(debruijn);
|
||||
let p = ty::PlaceholderRegion { universe, name: br.kind };
|
||||
self.mapped_regions.insert(p.clone(), br);
|
||||
self.mapped_regions.insert(p, br);
|
||||
self.infcx.tcx.mk_region(ty::RePlaceholder(p))
|
||||
}
|
||||
_ => r,
|
||||
|
@ -613,7 +613,7 @@ impl TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
|
|||
ty::Bound(debruijn, bound_ty) if debruijn >= self.current_index => {
|
||||
let universe = self.universe_for(debruijn);
|
||||
let p = ty::PlaceholderType { universe, name: bound_ty.var };
|
||||
self.mapped_types.insert(p.clone(), bound_ty);
|
||||
self.mapped_types.insert(p, bound_ty);
|
||||
self.infcx.tcx.mk_ty(ty::Placeholder(p))
|
||||
}
|
||||
_ if t.has_vars_bound_at_or_above(self.current_index) => t.super_fold_with(self),
|
||||
|
@ -637,7 +637,7 @@ impl TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
|
|||
universe,
|
||||
name: ty::BoundConst { var: bound_const, ty },
|
||||
};
|
||||
self.mapped_consts.insert(p.clone(), bound_const);
|
||||
self.mapped_consts.insert(p, bound_const);
|
||||
self.infcx.tcx.mk_const(ty::Const { val: ty::ConstKind::Placeholder(p), ty })
|
||||
}
|
||||
_ if ct.has_vars_bound_at_or_above(self.current_index) => ct.super_fold_with(self),
|
||||
|
|
|
@ -2445,7 +2445,7 @@ impl<'tcx> ProvisionalEvaluationCache<'tcx> {
|
|||
"get_provisional = {:#?}",
|
||||
self.map.borrow().get(&fresh_trait_ref),
|
||||
);
|
||||
Some(self.map.borrow().get(&fresh_trait_ref)?.clone())
|
||||
Some(*self.map.borrow().get(&fresh_trait_ref)?)
|
||||
}
|
||||
|
||||
/// Insert a provisional result into the cache. The result came
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue