Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/dyn_compatibility.rs')
-rw-r--r--crates/hir-ty/src/dyn_compatibility.rs25
1 files changed, 12 insertions, 13 deletions
diff --git a/crates/hir-ty/src/dyn_compatibility.rs b/crates/hir-ty/src/dyn_compatibility.rs
index 30949c83bf..6294d683e6 100644
--- a/crates/hir-ty/src/dyn_compatibility.rs
+++ b/crates/hir-ty/src/dyn_compatibility.rs
@@ -136,16 +136,15 @@ pub fn generics_require_sized_self(db: &dyn HirDatabase, def: GenericDefId) -> b
let predicates = predicates.iter().map(|p| p.skip_binders().skip_binders().clone());
elaborate_clause_supertraits(db, predicates).any(|pred| match pred {
WhereClause::Implemented(trait_ref) => {
- if from_chalk_trait_id(trait_ref.trait_id) == sized {
- if let TyKind::BoundVar(it) =
+ if from_chalk_trait_id(trait_ref.trait_id) == sized
+ && let TyKind::BoundVar(it) =
*trait_ref.self_type_parameter(Interner).kind(Interner)
- {
- // Since `generic_predicates` is `Binder<Binder<..>>`, the `DebrujinIndex` of
- // self-parameter is `1`
- return it
- .index_if_bound_at(DebruijnIndex::ONE)
- .is_some_and(|idx| idx == trait_self_param_idx);
- }
+ {
+ // Since `generic_predicates` is `Binder<Binder<..>>`, the `DebrujinIndex` of
+ // self-parameter is `1`
+ return it
+ .index_if_bound_at(DebruijnIndex::ONE)
+ .is_some_and(|idx| idx == trait_self_param_idx);
}
false
}
@@ -401,10 +400,10 @@ where
cb(MethodViolationCode::ReferencesSelfOutput)?;
}
- if !func_data.is_async() {
- if let Some(mvc) = contains_illegal_impl_trait_in_trait(db, &sig) {
- cb(mvc)?;
- }
+ if !func_data.is_async()
+ && let Some(mvc) = contains_illegal_impl_trait_in_trait(db, &sig)
+ {
+ cb(mvc)?;
}
let generic_params = db.generic_params(func.into());