From 5804b3fae8732576146a7da0b600b2088183dc31 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 4 Jan 2021 14:24:37 +0100 Subject: Fix HoverAction::Implementation typo --- crates/ide/src/hover.rs | 21 +++++++++++---------- crates/rust-analyzer/src/handlers.rs | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index e9103ce59..c0786eb51 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -70,7 +70,7 @@ impl HoverConfig { #[derive(Debug, Clone)] pub enum HoverAction { Runnable(Runnable), - Implementaion(FilePosition), + Implementation(FilePosition), GoToType(Vec), } @@ -116,12 +116,13 @@ pub(crate) fn hover( }; if let Some(definition) = definition { if let Some(markup) = hover_for_definition(db, definition) { + let markup = markup.as_str(); let markup = if !markdown { - remove_markdown(&markup.as_str()) + remove_markdown(markup) } else if links_in_hover { - rewrite_links(db, &markup.as_str(), &definition) + rewrite_links(db, markup, &definition) } else { - remove_links(&markup.as_str()) + remove_links(markup) }; res.markup = Markup::from(markup); if let Some(action) = show_implementations_action(db, definition) { @@ -175,7 +176,7 @@ pub(crate) fn hover( fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option { fn to_action(nav_target: NavigationTarget) -> HoverAction { - HoverAction::Implementaion(FilePosition { + HoverAction::Implementation(FilePosition { file_id: nav_target.file_id, offset: nav_target.focus_or_full_range().start(), }) @@ -1391,7 +1392,7 @@ fn bar() { fo<|>o(); } r"unsafe trait foo<|>() {}", expect![[r#" [ - Implementaion( + Implementation( FilePosition { file_id: FileId( 0, @@ -2103,7 +2104,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } r#"trait foo<|>() {}"#, expect![[r#" [ - Implementaion( + Implementation( FilePosition { file_id: FileId( 0, @@ -2122,7 +2123,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } r"struct foo<|>() {}", expect![[r#" [ - Implementaion( + Implementation( FilePosition { file_id: FileId( 0, @@ -2141,7 +2142,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } r#"union foo<|>() {}"#, expect![[r#" [ - Implementaion( + Implementation( FilePosition { file_id: FileId( 0, @@ -2160,7 +2161,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } r"enum foo<|>() { A, B }", expect![[r#" [ - Implementaion( + Implementation( FilePosition { file_id: FileId( 0, diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index dd486070b..c21ca044a 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs @@ -1648,7 +1648,7 @@ fn prepare_hover_actions( actions .iter() .filter_map(|it| match it { - HoverAction::Implementaion(position) => show_impl_command_link(snap, position), + HoverAction::Implementation(position) => show_impl_command_link(snap, position), HoverAction::Runnable(r) => runnable_action_links(snap, file_id, r.clone()), HoverAction::GoToType(targets) => goto_type_action_links(snap, targets), }) -- cgit v1.2.3