mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Add SubstsBuilder
+ further refactoring.
This commit is contained in:
parent
1002e47074
commit
daaf46177e
11 changed files with 212 additions and 126 deletions
|
@ -339,10 +339,14 @@ pub struct Struct {
|
|||
}
|
||||
|
||||
impl Struct {
|
||||
pub fn module(self, db: &impl HirDatabase) -> Module {
|
||||
pub fn module(self, db: &impl DefDatabase) -> Module {
|
||||
self.id.module(db)
|
||||
}
|
||||
|
||||
pub fn krate(self, db: &impl DefDatabase) -> Option<Crate> {
|
||||
self.module(db).krate(db)
|
||||
}
|
||||
|
||||
pub fn name(self, db: &impl DefDatabase) -> Option<Name> {
|
||||
db.struct_data(self).name.clone()
|
||||
}
|
||||
|
@ -423,10 +427,14 @@ pub struct Enum {
|
|||
}
|
||||
|
||||
impl Enum {
|
||||
pub fn module(self, db: &impl HirDatabase) -> Module {
|
||||
pub fn module(self, db: &impl DefDatabase) -> Module {
|
||||
self.id.module(db)
|
||||
}
|
||||
|
||||
pub fn krate(self, db: &impl DefDatabase) -> Option<Crate> {
|
||||
self.module(db).krate(db)
|
||||
}
|
||||
|
||||
pub fn name(self, db: &impl DefDatabase) -> Option<Name> {
|
||||
db.enum_data(self).name.clone()
|
||||
}
|
||||
|
@ -514,7 +522,7 @@ impl Adt {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn krate(self, db: &impl HirDatabase) -> Option<Crate> {
|
||||
pub fn krate(self, db: &impl HirDatabase) -> Option<Crate> {
|
||||
match self {
|
||||
Adt::Struct(s) => s.module(db),
|
||||
Adt::Union(s) => s.module(db),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue