1
Fork 0

Rollup merge of #119003 - matthiaskrgr:nein_clone, r=Nadrieril

NFC: do not clone types that are copy
This commit is contained in:
Jubilee 2023-12-15 21:33:00 -08:00 committed by GitHub
commit c9ba4583aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 6 deletions

View file

@ -341,13 +341,13 @@ impl<'tcx> CanonicalParamEnvCache<'tcx> {
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 @@ impl<'tcx> Const<'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()
}
}