mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-18 00:00:03 +00:00
migrate enums to new id
This commit is contained in:
parent
cefc5cbb4a
commit
566c8e321e
9 changed files with 190 additions and 142 deletions
|
@ -430,6 +430,13 @@ impl StructDef {
|
|||
}
|
||||
|
||||
impl EnumVariant {
|
||||
pub fn parent_enum(&self) -> &EnumDef {
|
||||
self.syntax()
|
||||
.parent()
|
||||
.and_then(|it| it.parent())
|
||||
.and_then(EnumDef::cast)
|
||||
.expect("EnumVariants are always nested in Enums")
|
||||
}
|
||||
pub fn flavor(&self) -> StructFlavor {
|
||||
StructFlavor::from_node(self)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue