This commit is contained in:
Aleksey Kladov 2019-11-20 22:00:57 +03:00
parent 6241cf9a59
commit 1cead41510
2 changed files with 15 additions and 41 deletions

View file

@ -432,15 +432,16 @@ impl Adt {
}
}
pub fn module(self, db: &impl DefDatabase) -> Module {
match self {
Adt::Struct(s) => s.module(db),
Adt::Union(s) => s.module(db),
Adt::Enum(e) => e.module(db),
}
}
pub fn krate(self, db: &impl HirDatabase) -> Option<Crate> {
Some(
match self {
Adt::Struct(s) => s.module(db),
Adt::Union(s) => s.module(db),
Adt::Enum(e) => e.module(db),
}
.krate(),
)
Some(self.module(db).krate())
}
}