Remove some unnecessary cloning in method_resolution

This commit is contained in:
Lukas Wirth 2024-03-04 16:04:19 +01:00
parent 593156a357
commit d21f88883b
8 changed files with 76 additions and 78 deletions

View file

@ -4025,7 +4025,7 @@ impl Type {
let canonical_ty =
Canonical { value: self.ty.clone(), binders: CanonicalVarKinds::empty(Interner) };
method_resolution::implements_trait(&canonical_ty, db, self.env.clone(), trait_)
method_resolution::implements_trait(&canonical_ty, db, &self.env, trait_)
}
/// Checks that particular type `ty` implements `std::ops::FnOnce`.
@ -4040,12 +4040,7 @@ impl Type {
let canonical_ty =
Canonical { value: self.ty.clone(), binders: CanonicalVarKinds::empty(Interner) };
method_resolution::implements_trait_unique(
&canonical_ty,
db,
self.env.clone(),
fnonce_trait,
)
method_resolution::implements_trait_unique(&canonical_ty, db, &self.env, fnonce_trait)
}
// FIXME: Find better API that also handles const generics