Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/completions/record.rs')
-rw-r--r--crates/ide-completion/src/completions/record.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/crates/ide-completion/src/completions/record.rs b/crates/ide-completion/src/completions/record.rs
index 46213deb0a..e53d1cc632 100644
--- a/crates/ide-completion/src/completions/record.rs
+++ b/crates/ide-completion/src/completions/record.rs
@@ -1,6 +1,9 @@
//! Complete fields in record literals and patterns.
use ide_db::SymbolKind;
-use syntax::ast::{self, Expr};
+use syntax::{
+ ast::{self, Expr},
+ SmolStr,
+};
use crate::{
context::{DotAccess, DotAccessKind, PatternContext},
@@ -66,8 +69,11 @@ pub(crate) fn complete_record_expr_fields(
}
if dot_prefix {
cov_mark::hit!(functional_update_one_dot);
- let mut item =
- CompletionItem::new(CompletionItemKind::Snippet, ctx.source_range(), "..");
+ let mut item = CompletionItem::new(
+ CompletionItemKind::Snippet,
+ ctx.source_range(),
+ SmolStr::new_static(".."),
+ );
item.insert_text(".");
item.add_to(acc, ctx.db);
return;
@@ -91,7 +97,11 @@ pub(crate) fn add_default_update(
// FIXME: This should make use of scope_def like completions so we get all the other goodies
// that is we should handle this like actually completing the default function
let completion_text = "..Default::default()";
- let mut item = CompletionItem::new(SymbolKind::Field, ctx.source_range(), completion_text);
+ let mut item = CompletionItem::new(
+ SymbolKind::Field,
+ ctx.source_range(),
+ SmolStr::new_static(completion_text),
+ );
let completion_text =
completion_text.strip_prefix(ctx.token.text()).unwrap_or(completion_text);
item.insert_text(completion_text).set_relevance(CompletionRelevance {