diff options
author | Lukas Wirth <[email protected]> | 2021-01-25 23:44:27 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-01-26 00:01:00 +0000 |
commit | d912444cacb0f9079680c505b3bb075fbeb208be (patch) | |
tree | 45f709cbd6e97f2c44e45927e1224b7a01364584 /crates/ide/src/display | |
parent | aa91a0268bae6deda964a9fdfcbdbd2d8ca5802f (diff) |
Shorten hir::TypeParam full_range in NavigationTarget
Diffstat (limited to 'crates/ide/src/display')
-rw-r--r-- | crates/ide/src/display/navigation_target.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index f178dd744..23d885218 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs | |||
@@ -435,13 +435,16 @@ impl TryToNav for hir::TypeParam { | |||
435 | fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { | 435 | fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> { |
436 | let src = self.source(db)?; | 436 | let src = self.source(db)?; |
437 | let full_range = match &src.value { | 437 | let full_range = match &src.value { |
438 | Either::Left(it) => it.syntax().text_range(), | 438 | Either::Left(it) => it |
439 | .name() | ||
440 | .map_or_else(|| it.syntax().text_range(), |name| name.syntax().text_range()), | ||
439 | Either::Right(it) => it.syntax().text_range(), | 441 | Either::Right(it) => it.syntax().text_range(), |
440 | }; | 442 | }; |
441 | let focus_range = match &src.value { | 443 | let focus_range = match &src.value { |
442 | Either::Left(_) => None, | 444 | Either::Left(it) => it.name(), |
443 | Either::Right(it) => it.name().map(|it| it.syntax().text_range()), | 445 | Either::Right(it) => it.name(), |
444 | }; | 446 | } |
447 | .map(|it| it.syntax().text_range()); | ||
445 | Some(NavigationTarget { | 448 | Some(NavigationTarget { |
446 | file_id: src.file_id.original_file(db), | 449 | file_id: src.file_id.original_file(db), |
447 | name: self.name(db).to_string().into(), | 450 | name: self.name(db).to_string().into(), |