diff --git a/crates/ide/src/annotations.rs b/crates/ide/src/annotations.rs index b7b4bd8fbe..8852991016 100644 --- a/crates/ide/src/annotations.rs +++ b/crates/ide/src/annotations.rs @@ -70,14 +70,8 @@ pub(crate) fn annotations( hir::ModuleDef::Trait(trait_) => { trait_.source(db).and_then(|node| name_range(&node, file_id)) } - hir::ModuleDef::Adt(hir::Adt::Struct(strukt)) => { - strukt.source(db).and_then(|node| name_range(&node, file_id)) - } - hir::ModuleDef::Adt(hir::Adt::Enum(enum_)) => { - enum_.source(db).and_then(|node| name_range(&node, file_id)) - } - hir::ModuleDef::Adt(hir::Adt::Union(union)) => { - union.source(db).and_then(|node| name_range(&node, file_id)) + hir::ModuleDef::Adt(adt) => { + adt.source(db).and_then(|node| name_range(&node, file_id)) } _ => None, }; diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index 82c5320140..28ddc499e9 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs @@ -528,6 +528,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> ast::Static(it) => sema.to_def(&it).map(|it| it.display(db).to_string()), ast::RecordField(it) => sema.to_def(&it).map(|it| it.display(db).to_string()), ast::Variant(it) => sema.to_def(&it).map(|it| it.display(db).to_string()), + ast::Union(it) => sema.to_def(&it).map(|it| it.display(db).to_string()), _ => None, } } diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs index 627f5e97fa..431a36d8a2 100644 --- a/crates/ide_db/src/search.rs +++ b/crates/ide_db/src/search.rs @@ -246,13 +246,9 @@ impl Definition { hir::GenericDef::Function(it) => { it.source(db).map(|src| src.value.syntax().text_range()) } - hir::GenericDef::Adt(it) => match it { - hir::Adt::Struct(it) => { - it.source(db).map(|src| src.value.syntax().text_range()) - } - hir::Adt::Union(it) => it.source(db).map(|src| src.value.syntax().text_range()), - hir::Adt::Enum(it) => it.source(db).map(|src| src.value.syntax().text_range()), - }, + hir::GenericDef::Adt(it) => { + it.source(db).map(|src| src.value.syntax().text_range()) + } hir::GenericDef::Trait(it) => { it.source(db).map(|src| src.value.syntax().text_range()) }