mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-30 11:37:31 +00:00
Generalize some type walking in hover type actions
This commit is contained in:
parent
9c7d8bbdc0
commit
3361b5701a
3 changed files with 47 additions and 31 deletions
|
|
@ -989,3 +989,19 @@ impl From<GenericDef> for Definition {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<Definition> for GenericDef {
|
||||
type Error = ();
|
||||
fn try_from(def: Definition) -> Result<Self, Self::Error> {
|
||||
match def {
|
||||
Definition::Function(it) => Ok(it.into()),
|
||||
Definition::Adt(it) => Ok(it.into()),
|
||||
Definition::Trait(it) => Ok(it.into()),
|
||||
Definition::TraitAlias(it) => Ok(it.into()),
|
||||
Definition::TypeAlias(it) => Ok(it.into()),
|
||||
Definition::SelfType(it) => Ok(it.into()),
|
||||
Definition::Const(it) => Ok(it.into()),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue