Skip to content

Commit f73d0ee

Browse files
committed
Minor cleanup
1 parent 64a1b26 commit f73d0ee

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

crates/hir_ty/src/infer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ use rustc_hash::FxHashMap;
3434
use stdx::impl_from;
3535
use syntax::SmolStr;
3636

37-
use super::{DomainGoal, InEnvironment, ProjectionTy, TraitEnvironment, TraitRef, Ty};
3837
use crate::{
3938
db::HirDatabase, fold_tys, lower::ImplTraitLoweringMode, to_assoc_type_id, AliasEq, AliasTy,
40-
Goal, Interner, Substitution, TyBuilder, TyExt, TyKind,
39+
DomainGoal, Goal, InEnvironment, Interner, ProjectionTy, Substitution, TraitEnvironment,
40+
TraitRef, Ty, TyBuilder, TyExt, TyKind,
4141
};
4242

4343
// This lint has a false positive here. See the link below for details.

crates/hir_ty/src/infer/coerce.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ use hir_def::{expr::ExprId, lang_item::LangItemTarget};
1010

1111
use crate::{
1212
autoderef,
13-
infer::{Adjust, Adjustment, AutoBorrow, InferResult, PointerCast, TypeMismatch},
14-
static_lifetime, Canonical, DomainGoal, FnPointer, FnSig, Interner, Solution, Substitution, Ty,
15-
TyBuilder, TyExt, TyKind,
13+
infer::{
14+
Adjust, Adjustment, AutoBorrow, InferOk, InferResult, InferenceContext, PointerCast,
15+
TypeError, TypeMismatch,
16+
},
17+
static_lifetime, Canonical, DomainGoal, FnPointer, FnSig, InEnvironment, Interner, Solution,
18+
Substitution, Ty, TyBuilder, TyExt, TyKind,
1619
};
1720

18-
use super::{InEnvironment, InferOk, InferenceContext, TypeError};
19-
2021
pub(crate) type CoerceResult = Result<InferOk<(Vec<Adjustment>, Ty)>, TypeError>;
2122

2223
/// Do not require any adjustments, i.e. coerce `x -> x`.
@@ -36,6 +37,7 @@ fn success(
3637
) -> CoerceResult {
3738
Ok(InferOk { goals, value: (adj, target) })
3839
}
40+
3941
#[derive(Clone, Debug)]
4042
pub(super) struct CoerceMany {
4143
expected_ty: Ty,
@@ -171,12 +173,8 @@ impl<'a> InferenceContext<'a> {
171173

172174
// Examine the supertype and consider auto-borrowing.
173175
match to_ty.kind(&Interner) {
174-
TyKind::Raw(mt, _) => {
175-
return self.coerce_ptr(from_ty, to_ty, *mt);
176-
}
177-
TyKind::Ref(mt, _, _) => {
178-
return self.coerce_ref(from_ty, to_ty, *mt);
179-
}
176+
TyKind::Raw(mt, _) => return self.coerce_ptr(from_ty, to_ty, *mt),
177+
TyKind::Ref(mt, _, _) => return self.coerce_ref(from_ty, to_ty, *mt),
180178
_ => {}
181179
}
182180

@@ -337,7 +335,7 @@ impl<'a> InferenceContext<'a> {
337335
return Err(err);
338336
}
339337
};
340-
// FIXME: record overloarded deref adjustments
338+
// FIXME: record overloaded deref adjustments
341339
success(
342340
vec![Adjustment { kind: Adjust::Borrow(AutoBorrow::Ref(to_mt)), target: ty.clone() }],
343341
ty,

0 commit comments

Comments
 (0)