X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=crates%2Fide_completion%2Fsrc%2Frender%2Fconst_.rs;h=707b6533b5423e6a6556c5a07d377da56e97c2e9;hb=2f5afba9f8ce7b7133ba1c4d8e009462cecb17f5;hp=241e0043c9c5222e8fd458625e7f76b4499ad12d;hpb=439a8194b0c498ee2ac12832c5d5d80316a6c0ab;p=rust.git diff --git a/crates/ide_completion/src/render/const_.rs b/crates/ide_completion/src/render/const_.rs index 241e0043c9c..707b6533b54 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 @@ fn new(ctx: RenderContext<'a>, const_: hir::Const) -> Option> { } fn render(self) -> Option { - 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 @@ fn render(self) -> Option { 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 @@ fn render(self) -> Option { Some(item.build()) } - fn name(&self) -> Option { - self.ast_node.name().map(|name| name.text().to_string()) - } - fn detail(&self) -> String { const_label(&self.ast_node) }