NFC: do not clone types that are copy

This commit is contained in:
Matthias Krüger 2023-12-15 23:19:51 +01:00
parent a96d57bdb6
commit 74d81d15b4
5 changed files with 6 additions and 6 deletions

View file

@ -353,7 +353,7 @@ fn checked_binop(
let new_kind = match ty.kind() {
Int(t @ Isize) => Int(t.normalize(self.tcx.sess.target.pointer_width)),
Uint(t @ Usize) => Uint(t.normalize(self.tcx.sess.target.pointer_width)),
t @ (Uint(_) | Int(_)) => t.clone(),
t @ (Uint(_) | Int(_)) => *t,
_ => panic!("tried to get overflow intrinsic for op applied to non-int type"),
};

View file

@ -341,13 +341,13 @@ pub fn get_or_insert(
Entry::Occupied(e) => {
let (canonical, var_values) = e.get();
state.var_values.extend_from_slice(var_values);
canonical.clone()
*canonical
}
Entry::Vacant(e) => {
let canonical = canonicalize_op(tcx, key, state);
let OriginalQueryValues { var_values, universe_map } = state;
assert_eq!(universe_map.len(), 1);
e.insert((canonical.clone(), tcx.arena.alloc_slice(var_values)));
e.insert((canonical, tcx.arena.alloc_slice(var_values)));
canonical
}
}

View file

@ -59,7 +59,7 @@ pub fn ty(self) -> Ty<'tcx> {
#[inline]
pub fn kind(self) -> ConstKind<'tcx> {
self.0.kind.clone()
self.0.kind
}
#[inline]

View file

@ -473,7 +473,7 @@ impl<'tcx> IntoKind for Ty<'tcx> {
type Kind = TyKind<'tcx>;
fn kind(self) -> TyKind<'tcx> {
self.kind().clone()
*self.kind()
}
}

View file

@ -923,7 +923,7 @@ pub(crate) fn split<'a, 'tcx>(
}
ConstructorSet::Integers { range_1, range_2 } => {
let seen_ranges: Vec<_> =
seen.iter().map(|ctor| ctor.as_int_range().unwrap().clone()).collect();
seen.iter().map(|ctor| *ctor.as_int_range().unwrap()).collect();
for (seen, splitted_range) in range_1.split(seen_ranges.iter().cloned()) {
match seen {
Presence::Unseen => missing.push(IntRange(splitted_range)),