mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Merge #9895
9895: minor: Simplify r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
5a60e9106b
3 changed files with 6 additions and 15 deletions
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue