fix clippy::clone_on_copy: don't clone types that are copy
This commit is contained in:
parent
15dcda36e6
commit
ff692ab14f
@ -50,7 +50,7 @@ impl TypeRelation<'tcx> for Glb<'combine, 'infcx, 'tcx> {
|
||||
ty::Invariant => self.fields.equate(self.a_is_expected).relate(a, b),
|
||||
ty::Covariant => self.relate(a, b),
|
||||
// FIXME(#41044) -- not correct, need test
|
||||
ty::Bivariant => Ok(a.clone()),
|
||||
ty::Bivariant => Ok(a),
|
||||
ty::Contravariant => self.fields.lub(self.a_is_expected).relate(a, b),
|
||||
}
|
||||
}
|
||||
@ -97,7 +97,7 @@ impl TypeRelation<'tcx> for Glb<'combine, 'infcx, 'tcx> {
|
||||
// very challenging, switch to invariance. This is obviously
|
||||
// overly conservative but works ok in practice.
|
||||
self.relate_with_variance(ty::Variance::Invariant, a, b)?;
|
||||
Ok(a.clone())
|
||||
Ok(a)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -719,7 +719,7 @@ where
|
||||
self.a_scopes.pop().unwrap();
|
||||
}
|
||||
|
||||
Ok(a.clone())
|
||||
Ok(a)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
|
||||
match variance {
|
||||
ty::Invariant => self.fields.equate(self.a_is_expected).relate(a, b),
|
||||
ty::Covariant => self.relate(a, b),
|
||||
ty::Bivariant => Ok(a.clone()),
|
||||
ty::Bivariant => Ok(a),
|
||||
ty::Contravariant => self.with_expected_switched(|this| this.relate(b, a)),
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ pub fn equal_up_to_regions(
|
||||
T: Relate<'tcx>,
|
||||
{
|
||||
self.relate(a.skip_binder(), b.skip_binder())?;
|
||||
Ok(a.clone())
|
||||
Ok(a)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
|
||||
}
|
||||
|
||||
pub fn span(&self) -> Span {
|
||||
self.span.clone()
|
||||
self.span
|
||||
}
|
||||
|
||||
pub fn reached_recursion_limit(&self) -> bool {
|
||||
|
@ -368,6 +368,6 @@ impl TypeRelation<'tcx> for SimpleEqRelation<'tcx> {
|
||||
let anon_b = self.tcx.anonymize_late_bound_regions(&b);
|
||||
self.relate(anon_a.skip_binder(), anon_b.skip_binder())?;
|
||||
|
||||
Ok(a.clone())
|
||||
Ok(a)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user