Skip to content

Commit 936c695

Browse files
committed
Remove last traces of adt from Ty
1 parent 882fe0a commit 936c695

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

crates/ra_hir/src/code_model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ impl Type {
11041104

11051105
pub fn as_adt(&self) -> Option<Adt> {
11061106
let (adt, _subst) = self.ty.value.as_adt()?;
1107-
Some(adt)
1107+
Some(adt.into())
11081108
}
11091109

11101110
fn derived(&self, ty: Ty) -> Type {

crates/ra_hir/src/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
db::HirDatabase,
1313
diagnostics::{MissingFields, MissingOkInTailExpr},
1414
ty::{ApplicationTy, InferenceResult, Ty, TypeCtor},
15-
Adt, Function, Name, Path,
15+
Function, Name, Path, Struct,
1616
};
1717

1818
pub use hir_def::{
@@ -69,7 +69,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
6969
}
7070

7171
let struct_def = match self.infer[id].as_adt() {
72-
Some((Adt::Struct(s), _)) => s,
72+
Some((AdtId::StructId(s), _)) => Struct::from(s),
7373
_ => return,
7474
};
7575

crates/ra_hir/src/ty.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ use hir_def::{
2222
expr::ExprId, generics::GenericParams, type_ref::Mutability, AdtId, ContainerId, DefWithBodyId,
2323
GenericDefId, HasModule, Lookup, TraitId, TypeAliasId,
2424
};
25+
use hir_expand::name::Name;
2526
use ra_db::{impl_intern_key, salsa};
2627

2728
use crate::{
2829
db::HirDatabase,
2930
ty::primitive::{FloatTy, IntTy, Uncertain},
3031
util::make_mut_slice,
31-
Adt, Crate, Name,
32+
Crate,
3233
};
3334
use display::{HirDisplay, HirFormatter};
3435

@@ -598,10 +599,10 @@ impl Ty {
598599
}
599600
}
600601

601-
pub fn as_adt(&self) -> Option<(Adt, &Substs)> {
602+
pub fn as_adt(&self) -> Option<(AdtId, &Substs)> {
602603
match self {
603604
Ty::Apply(ApplicationTy { ctor: TypeCtor::Adt(adt_def), parameters }) => {
604-
Some(((*adt_def).into(), parameters))
605+
Some((*adt_def, parameters))
605606
}
606607
_ => None,
607608
}

0 commit comments

Comments
 (0)