From c2015e7d182f3cb2cebe686127dd6a3e683df9e6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 14 Jun 2021 22:42:43 +0300 Subject: 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. --- crates/ide/src/display/navigation_target.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index b75ec411c..455b32456 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs @@ -442,10 +442,10 @@ impl TryToNav for hir::TypeParam { fn try_to_nav(&self, db: &RootDatabase) -> Option { 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(), -- cgit v1.2.3