Avoid extra allocation in completion rendering

This commit is contained in:
Laurențiu Nicola 2021-09-06 17:55:07 +03:00
parent cbc13ae6bd
commit d27ed8c243

View file

@ -101,7 +101,7 @@ pub(crate) fn render_field(
.lookup_by(name.as_str()); .lookup_by(name.as_str());
let is_keyword = SyntaxKind::from_keyword(name.as_str()).is_some(); let is_keyword = SyntaxKind::from_keyword(name.as_str()).is_some();
if is_keyword && !matches!(name.as_str(), "self" | "crate" | "super" | "Self") { if is_keyword && !matches!(name.as_str(), "self" | "crate" | "super" | "Self") {
item.insert_text(String::from("r#") + name.as_str()); item.insert_text(format!("r#{}", name));
} }
if let Some(_ref_match) = compute_ref_match(ctx.completion, ty) { if let Some(_ref_match) = compute_ref_match(ctx.completion, ty) {
// FIXME // FIXME