mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
internal: more natural order of sources for TypeParam
We usually use first (left) variant of `Either` for "usual" case, and use right for odd things. For example, pat source is Pat | SelfParam.
This commit is contained in:
parent
4cfc767d7f
commit
c2015e7d18
5 changed files with 12 additions and 12 deletions
|
@ -442,10 +442,10 @@ impl TryToNav for hir::TypeParam {
|
|||
fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> {
|
||||
let src = self.source(db)?;
|
||||
let full_range = match &src.value {
|
||||
Either::Left(it) => it
|
||||
Either::Left(type_param) => type_param.syntax().text_range(),
|
||||
Either::Right(trait_) => trait_
|
||||
.name()
|
||||
.map_or_else(|| it.syntax().text_range(), |name| name.syntax().text_range()),
|
||||
Either::Right(it) => it.syntax().text_range(),
|
||||
.map_or_else(|| trait_.syntax().text_range(), |name| name.syntax().text_range()),
|
||||
};
|
||||
let focus_range = match &src.value {
|
||||
Either::Left(it) => it.name(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue