Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide_completion/src/render/const_.rs')
| -rw-r--r-- | crates/ide_completion/src/render/const_.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/crates/ide_completion/src/render/const_.rs b/crates/ide_completion/src/render/const_.rs index 241e0043c9..707b6533b5 100644 --- a/crates/ide_completion/src/render/const_.rs +++ b/crates/ide_completion/src/render/const_.rs @@ -2,10 +2,7 @@ use hir::{AsAssocItem, HasSource}; use ide_db::SymbolKind; -use syntax::{ - ast::{Const, HasName}, - display::const_label, -}; +use syntax::{ast::Const, display::const_label}; use crate::{item::CompletionItem, render::RenderContext}; @@ -27,7 +24,7 @@ impl<'a> ConstRender<'a> { } fn render(self) -> Option<CompletionItem> { - let name = self.name()?; + let name = self.const_.name(self.ctx.db())?.to_smol_str(); let detail = self.detail(); let mut item = @@ -42,7 +39,7 @@ impl<'a> ConstRender<'a> { let db = self.ctx.db(); if let Some(actm) = self.const_.as_assoc_item(db) { if let Some(trt) = actm.containing_trait_or_trait_impl(db) { - item.trait_name(trt.name(db).to_string()); + item.trait_name(trt.name(db).to_smol_str()); item.insert_text(name); } } @@ -50,10 +47,6 @@ impl<'a> ConstRender<'a> { Some(item.build()) } - fn name(&self) -> Option<String> { - self.ast_node.name().map(|name| name.text().to_string()) - } - fn detail(&self) -> String { const_label(&self.ast_node) } |