about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com>2024-02-10 00:47:35 +0900
committerTetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com>2024-02-10 01:00:40 +0900
commitf4a4b6681b366eed2cc5e9817eab560cb08571a7 (patch)
tree19b8aa322ff92a0b3df5fc73605c1324109f1a90
parent395708d5e0793a5501f96c706877fb12b4f7eaf4 (diff)
downloadrust-f4a4b6681b366eed2cc5e9817eab560cb08571a7.tar.gz
rust-f4a4b6681b366eed2cc5e9817eab560cb08571a7.zip
ide-completion: Fix warnings about clippy `str_to_string` rule
-rw-r--r--crates/ide-completion/src/completions/extern_crate.rs4
-rw-r--r--crates/ide-completion/src/completions/postfix.rs2
-rw-r--r--crates/ide-completion/src/context.rs2
-rw-r--r--crates/ide-completion/src/item.rs2
-rw-r--r--crates/ide-completion/src/render.rs6
-rw-r--r--crates/ide-completion/src/render/function.rs4
-rw-r--r--crates/ide-completion/src/render/pattern.rs2
-rw-r--r--crates/ide-completion/src/render/variant.rs4
8 files changed, 13 insertions, 13 deletions
diff --git a/crates/ide-completion/src/completions/extern_crate.rs b/crates/ide-completion/src/completions/extern_crate.rs
index f9cde44667b..b67d82c20d8 100644
--- a/crates/ide-completion/src/completions/extern_crate.rs
+++ b/crates/ide-completion/src/completions/extern_crate.rs
@@ -46,7 +46,7 @@ mod other_mod {}
 
         let completion_list = completion_list_no_kw(case);
 
-        assert_eq!("md other_crate_a\n".to_string(), completion_list);
+        assert_eq!("md other_crate_a\n".to_owned(), completion_list);
     }
 
     #[test]
@@ -66,6 +66,6 @@ mod other_mod {}
 
         let completion_list = completion_list_no_kw(case);
 
-        assert_eq!("md other_crate_a\n".to_string(), completion_list);
+        assert_eq!("md other_crate_a\n".to_owned(), completion_list);
     }
 }
diff --git a/crates/ide-completion/src/completions/postfix.rs b/crates/ide-completion/src/completions/postfix.rs
index d34d2e7e98e..72c0885e92f 100644
--- a/crates/ide-completion/src/completions/postfix.rs
+++ b/crates/ide-completion/src/completions/postfix.rs
@@ -326,7 +326,7 @@ fn build_postfix_snippet_builder<'ctx>(
         delete_range: TextRange,
     ) -> impl Fn(&str, &str, &str) -> Builder + 'ctx {
         move |label, detail, snippet| {
-            let edit = TextEdit::replace(delete_range, snippet.to_string());
+            let edit = TextEdit::replace(delete_range, snippet.to_owned());
             let mut item =
                 CompletionItem::new(CompletionItemKind::Snippet, ctx.source_range(), label);
             item.detail(detail).snippet_edit(cap, edit);
diff --git a/crates/ide-completion/src/context.rs b/crates/ide-completion/src/context.rs
index e07937787cf..2a0004f60b8 100644
--- a/crates/ide-completion/src/context.rs
+++ b/crates/ide-completion/src/context.rs
@@ -665,7 +665,7 @@ impl<'a> CompletionContext<'a> {
         // actual completion.
         let file_with_fake_ident = {
             let parse = db.parse(file_id);
-            let edit = Indel::insert(offset, COMPLETION_MARKER.to_string());
+            let edit = Indel::insert(offset, COMPLETION_MARKER.to_owned());
             parse.reparse(&edit).tree()
         };
 
diff --git a/crates/ide-completion/src/item.rs b/crates/ide-completion/src/item.rs
index bcf169f4653..8552a20392a 100644
--- a/crates/ide-completion/src/item.rs
+++ b/crates/ide-completion/src/item.rs
@@ -553,7 +553,7 @@ impl Builder {
         self.detail = detail.map(Into::into);
         if let Some(detail) = &self.detail {
             if never!(detail.contains('\n'), "multiline detail:\n{}", detail) {
-                self.detail = Some(detail.split('\n').next().unwrap().to_string());
+                self.detail = Some(detail.split('\n').next().unwrap().to_owned());
             }
         }
         self
diff --git a/crates/ide-completion/src/render.rs b/crates/ide-completion/src/render.rs
index 5172829266e..548466d8de4 100644
--- a/crates/ide-completion/src/render.rs
+++ b/crates/ide-completion/src/render.rs
@@ -167,14 +167,14 @@ pub(crate) fn render_field(
         if !expected_fn_type {
             if let Some(receiver) = &dot_access.receiver {
                 if let Some(receiver) = ctx.completion.sema.original_ast_node(receiver.clone()) {
-                    builder.insert(receiver.syntax().text_range().start(), "(".to_string());
-                    builder.insert(ctx.source_range().end(), ")".to_string());
+                    builder.insert(receiver.syntax().text_range().start(), "(".to_owned());
+                    builder.insert(ctx.source_range().end(), ")".to_owned());
 
                     let is_parens_needed =
                         !matches!(dot_access.kind, DotAccessKind::Method { has_parens: true });
 
                     if is_parens_needed {
-                        builder.insert(ctx.source_range().end(), "()".to_string());
+                        builder.insert(ctx.source_range().end(), "()".to_owned());
                     }
                 }
             }
diff --git a/crates/ide-completion/src/render/function.rs b/crates/ide-completion/src/render/function.rs
index 4ae7ea861c7..f3ac06c1316 100644
--- a/crates/ide-completion/src/render/function.rs
+++ b/crates/ide-completion/src/render/function.rs
@@ -184,12 +184,12 @@ pub(super) fn add_call_parens<'b>(
                         }
                         None => {
                             let name = match param.ty().as_adt() {
-                                None => "_".to_string(),
+                                None => "_".to_owned(),
                                 Some(adt) => adt
                                     .name(ctx.db)
                                     .as_text()
                                     .map(|s| to_lower_snake_case(s.as_str()))
-                                    .unwrap_or_else(|| "_".to_string()),
+                                    .unwrap_or_else(|| "_".to_owned()),
                             };
                             f(&format_args!("${{{}:{name}}}", index + offset))
                         }
diff --git a/crates/ide-completion/src/render/pattern.rs b/crates/ide-completion/src/render/pattern.rs
index a5f851566cb..c07966f7a7a 100644
--- a/crates/ide-completion/src/render/pattern.rs
+++ b/crates/ide-completion/src/render/pattern.rs
@@ -140,7 +140,7 @@ fn render_pat(
         StructKind::Record => {
             render_record_as_pat(ctx.db(), ctx.snippet_cap(), fields, name, fields_omitted)
         }
-        StructKind::Unit => name.to_string(),
+        StructKind::Unit => name.to_owned(),
     };
 
     let needs_ascription = matches!(
diff --git a/crates/ide-completion/src/render/variant.rs b/crates/ide-completion/src/render/variant.rs
index a9a01a3a30f..28238de4559 100644
--- a/crates/ide-completion/src/render/variant.rs
+++ b/crates/ide-completion/src/render/variant.rs
@@ -23,7 +23,7 @@ pub(crate) fn render_record_lit(
     path: &str,
 ) -> RenderedLiteral {
     if snippet_cap.is_none() {
-        return RenderedLiteral { literal: path.to_string(), detail: path.to_string() };
+        return RenderedLiteral { literal: path.to_owned(), detail: path.to_owned() };
     }
     let completions = fields.iter().enumerate().format_with(", ", |(idx, field), f| {
         if snippet_cap.is_some() {
@@ -52,7 +52,7 @@ pub(crate) fn render_tuple_lit(
     path: &str,
 ) -> RenderedLiteral {
     if snippet_cap.is_none() {
-        return RenderedLiteral { literal: path.to_string(), detail: path.to_string() };
+        return RenderedLiteral { literal: path.to_owned(), detail: path.to_owned() };
     }
     let completions = fields.iter().enumerate().format_with(", ", |(idx, _), f| {
         if snippet_cap.is_some() {