diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-31 13:16:44 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-31 13:16:44 +0100 |
commit | d7cbb49057c4495307d91f5db32465c29c175124 (patch) | |
tree | 8649259da32910831c45aee3ba9b68abce8f5b37 /crates/ide_completion/src/render/macro_.rs | |
parent | 3cb3f1d17b54a7e144db495e073551049c9c482c (diff) | |
parent | 971b0836ef425d8b962ecac70a974887a8356567 (diff) |
Merge #9077
9077: internal: Use `Name`s instead of Strings in the completion rendering api r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/render/macro_.rs')
-rw-r--r-- | crates/ide_completion/src/render/macro_.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ide_completion/src/render/macro_.rs b/crates/ide_completion/src/render/macro_.rs index b90fd3890..0dfba8acc 100644 --- a/crates/ide_completion/src/render/macro_.rs +++ b/crates/ide_completion/src/render/macro_.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! Renderer for macro invocations. | 1 | //! Renderer for macro invocations. |
2 | 2 | ||
3 | use hir::{Documentation, HasSource}; | 3 | use hir::HasSource; |
4 | use ide_db::SymbolKind; | 4 | use ide_db::SymbolKind; |
5 | use syntax::display::macro_label; | 5 | use syntax::display::macro_label; |
6 | 6 | ||
@@ -12,7 +12,7 @@ use crate::{ | |||
12 | pub(crate) fn render_macro<'a>( | 12 | pub(crate) fn render_macro<'a>( |
13 | ctx: RenderContext<'a>, | 13 | ctx: RenderContext<'a>, |
14 | import_to_add: Option<ImportEdit>, | 14 | import_to_add: Option<ImportEdit>, |
15 | name: String, | 15 | name: hir::Name, |
16 | macro_: hir::MacroDef, | 16 | macro_: hir::MacroDef, |
17 | ) -> Option<CompletionItem> { | 17 | ) -> Option<CompletionItem> { |
18 | let _p = profile::span("render_macro"); | 18 | let _p = profile::span("render_macro"); |
@@ -24,13 +24,14 @@ struct MacroRender<'a> { | |||
24 | ctx: RenderContext<'a>, | 24 | ctx: RenderContext<'a>, |
25 | name: String, | 25 | name: String, |
26 | macro_: hir::MacroDef, | 26 | macro_: hir::MacroDef, |
27 | docs: Option<Documentation>, | 27 | docs: Option<hir::Documentation>, |
28 | bra: &'static str, | 28 | bra: &'static str, |
29 | ket: &'static str, | 29 | ket: &'static str, |
30 | } | 30 | } |
31 | 31 | ||
32 | impl<'a> MacroRender<'a> { | 32 | impl<'a> MacroRender<'a> { |
33 | fn new(ctx: RenderContext<'a>, name: String, macro_: hir::MacroDef) -> MacroRender<'a> { | 33 | fn new(ctx: RenderContext<'a>, name: hir::Name, macro_: hir::MacroDef) -> MacroRender<'a> { |
34 | let name = name.to_string(); | ||
34 | let docs = ctx.docs(macro_); | 35 | let docs = ctx.docs(macro_); |
35 | let docs_str = docs.as_ref().map_or("", |s| s.as_str()); | 36 | let docs_str = docs.as_ref().map_or("", |s| s.as_str()); |
36 | let (bra, ket) = guess_macro_braces(&name, docs_str); | 37 | let (bra, ket) = guess_macro_braces(&name, docs_str); |