Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/method_resolution.rs')
-rw-r--r--crates/hir-ty/src/method_resolution.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/hir-ty/src/method_resolution.rs b/crates/hir-ty/src/method_resolution.rs
index a679a114b4..73b07df56f 100644
--- a/crates/hir-ty/src/method_resolution.rs
+++ b/crates/hir-ty/src/method_resolution.rs
@@ -4,7 +4,7 @@
//! and the corresponding code mostly in rustc_hir_analysis/check/method/probe.rs.
use std::ops::ControlFlow;
-use base_db::{CrateId, Edition};
+use base_db::CrateId;
use chalk_ir::{cast::Cast, Mutability, TyKind, UniverseIndex, WhereClause};
use hir_def::{
data::{adt::StructFlags, ImplData},
@@ -15,6 +15,7 @@ use hir_def::{
use hir_expand::name::Name;
use rustc_hash::{FxHashMap, FxHashSet};
use smallvec::{smallvec, SmallVec};
+use span::Edition;
use stdx::never;
use triomphe::Arc;
@@ -643,7 +644,7 @@ pub fn is_dyn_method(
let ItemContainerId::TraitId(trait_id) = func.lookup(db.upcast()).container else {
return None;
};
- let trait_params = db.generic_params(trait_id.into()).type_or_consts.len();
+ let trait_params = db.generic_params(trait_id.into()).len();
let fn_params = fn_subst.len(Interner) - trait_params;
let trait_ref = TraitRef {
trait_id: to_chalk_trait_id(trait_id),
@@ -685,7 +686,7 @@ pub(crate) fn lookup_impl_method_query(
let ItemContainerId::TraitId(trait_id) = func.lookup(db.upcast()).container else {
return (func, fn_subst);
};
- let trait_params = db.generic_params(trait_id.into()).type_or_consts.len();
+ let trait_params = db.generic_params(trait_id.into()).len();
let fn_params = fn_subst.len(Interner) - trait_params;
let trait_ref = TraitRef {
trait_id: to_chalk_trait_id(trait_id),
@@ -966,7 +967,7 @@ pub fn iterate_method_candidates_dyn(
// the methods by autoderef order of *receiver types*, not *self
// types*.
- let mut table = InferenceTable::new(db, env.clone());
+ let mut table = InferenceTable::new(db, env);
let ty = table.instantiate_canonical(ty.clone());
let deref_chain = autoderef_method_receiver(&mut table, ty);
@@ -1044,7 +1045,7 @@ fn iterate_method_candidates_with_autoref(
let ref_muted = Canonical {
value: TyKind::Ref(Mutability::Mut, static_lifetime(), receiver_ty.value.clone())
.intern(Interner),
- binders: receiver_ty.binders.clone(),
+ binders: receiver_ty.binders,
};
iterate_method_candidates_by_receiver(ref_muted, first_adjustment.with_autoref(Mutability::Mut))
@@ -1060,7 +1061,7 @@ fn iterate_method_candidates_by_receiver(
name: Option<&Name>,
mut callback: &mut dyn FnMut(ReceiverAdjustments, AssocItemId, bool) -> ControlFlow<()>,
) -> ControlFlow<()> {
- let receiver_ty = table.instantiate_canonical(receiver_ty.clone());
+ let receiver_ty = table.instantiate_canonical(receiver_ty);
// We're looking for methods with *receiver* type receiver_ty. These could
// be found in any of the derefs of receiver_ty, so we have to go through
// that, including raw derefs.
@@ -1456,7 +1457,7 @@ fn is_valid_trait_method_candidate(
if let Some(receiver_ty) = receiver_ty {
check_that!(data.has_self_param());
- let fn_subst = TyBuilder::subst_for_def(db, fn_id, Some(impl_subst.clone()))
+ let fn_subst = TyBuilder::subst_for_def(db, fn_id, Some(impl_subst))
.fill_with_inference_vars(table)
.build();