Apply reviewed suggestions
This commit is contained in:
parent
fc53c59388
commit
d034ab0f92
@ -278,7 +278,7 @@ fn coerce_inner(&mut self, from_ty: Ty, to_ty: &Ty) -> CoerceResult {
|
||||
|
||||
// If we are coercing into an ATPIT, coerce into its proxy inference var, instead.
|
||||
let mut to_ty = to_ty;
|
||||
let mut _to = None;
|
||||
let _to;
|
||||
if let Some(atpit_table) = &self.atpit_coercion_table {
|
||||
if let TyKind::OpaqueType(opaque_ty_id, _) = to_ty.kind(Interner) {
|
||||
if !matches!(
|
||||
@ -286,8 +286,8 @@ fn coerce_inner(&mut self, from_ty: Ty, to_ty: &Ty) -> CoerceResult {
|
||||
TyKind::InferenceVar(..) | TyKind::OpaqueType(..)
|
||||
) {
|
||||
if let Some(ty) = atpit_table.get(opaque_ty_id) {
|
||||
_to = Some(ty.clone());
|
||||
to_ty = _to.as_ref().unwrap();
|
||||
_to = ty.clone();
|
||||
to_ty = &_to;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -301,13 +301,9 @@ pub fn lower_ty_ext(&self, type_ref: &TypeRef) -> (Ty, Option<TypeNs>) {
|
||||
TypeRef::ImplTrait(bounds) => {
|
||||
match &self.impl_trait_mode {
|
||||
ImplTraitLoweringState::Opaque(opaque_type_data) => {
|
||||
let (origin, krate) = match self.resolver.generic_def() {
|
||||
Some(GenericDefId::FunctionId(f)) => {
|
||||
(Either::Left(f), f.krate(self.db.upcast()))
|
||||
}
|
||||
Some(GenericDefId::TypeAliasId(a)) => {
|
||||
(Either::Right(a), a.krate(self.db.upcast()))
|
||||
}
|
||||
let origin = match self.resolver.generic_def() {
|
||||
Some(GenericDefId::FunctionId(it)) => Either::Left(it),
|
||||
Some(GenericDefId::TypeAliasId(it)) => Either::Right(it),
|
||||
_ => panic!(
|
||||
"opaque impl trait lowering must be in function or type alias"
|
||||
),
|
||||
@ -330,7 +326,7 @@ pub fn lower_ty_ext(&self, type_ref: &TypeRef) -> (Ty, Option<TypeNs>) {
|
||||
// away instead of two.
|
||||
let actual_opaque_type_data = self
|
||||
.with_debruijn(DebruijnIndex::INNERMOST, |ctx| {
|
||||
ctx.lower_impl_trait(bounds, krate)
|
||||
ctx.lower_impl_trait(bounds, self.resolver.krate())
|
||||
});
|
||||
opaque_type_data.borrow_mut()[idx] = actual_opaque_type_data;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user