Skip to content

Commit ff692ab

Browse files
committed
fix clippy::clone_on_copy: don't clone types that are copy
1 parent 15dcda3 commit ff692ab

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

src/librustc_infer/infer/glb.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl TypeRelation<'tcx> for Glb<'combine, 'infcx, 'tcx> {
5050
ty::Invariant => self.fields.equate(self.a_is_expected).relate(a, b),
5151
ty::Covariant => self.relate(a, b),
5252
// FIXME(#41044) -- not correct, need test
53-
ty::Bivariant => Ok(a.clone()),
53+
ty::Bivariant => Ok(a),
5454
ty::Contravariant => self.fields.lub(self.a_is_expected).relate(a, b),
5555
}
5656
}
@@ -97,7 +97,7 @@ impl TypeRelation<'tcx> for Glb<'combine, 'infcx, 'tcx> {
9797
// very challenging, switch to invariance. This is obviously
9898
// overly conservative but works ok in practice.
9999
self.relate_with_variance(ty::Variance::Invariant, a, b)?;
100-
Ok(a.clone())
100+
Ok(a)
101101
}
102102
}
103103

src/librustc_infer/infer/nll_relate/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ where
719719
self.a_scopes.pop().unwrap();
720720
}
721721

722-
Ok(a.clone())
722+
Ok(a)
723723
}
724724
}
725725

src/librustc_infer/infer/sub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
6868
match variance {
6969
ty::Invariant => self.fields.equate(self.a_is_expected).relate(a, b),
7070
ty::Covariant => self.relate(a, b),
71-
ty::Bivariant => Ok(a.clone()),
71+
ty::Bivariant => Ok(a),
7272
ty::Contravariant => self.with_expected_switched(|this| this.relate(b, a)),
7373
}
7474
}

src/librustc_mir/transform/validate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub fn equal_up_to_regions(
115115
T: Relate<'tcx>,
116116
{
117117
self.relate(a.skip_binder(), b.skip_binder())?;
118-
Ok(a.clone())
118+
Ok(a)
119119
}
120120
}
121121

src/librustc_trait_selection/autoderef.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
187187
}
188188

189189
pub fn span(&self) -> Span {
190-
self.span.clone()
190+
self.span
191191
}
192192

193193
pub fn reached_recursion_limit(&self) -> bool {

src/librustc_typeck/check/dropck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,6 @@ impl TypeRelation<'tcx> for SimpleEqRelation<'tcx> {
368368
let anon_b = self.tcx.anonymize_late_bound_regions(&b);
369369
self.relate(anon_a.skip_binder(), anon_b.skip_binder())?;
370370

371-
Ok(a.clone())
371+
Ok(a)
372372
}
373373
}

0 commit comments

Comments
 (0)