about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crates/ide/src/doc_links.rs10
-rw-r--r--crates/ide/src/file_structure.rs2
-rw-r--r--crates/ide/src/highlight_related.rs2
-rw-r--r--crates/ide/src/hover/render.rs10
-rw-r--r--crates/ide/src/interpret_function.rs4
-rw-r--r--crates/ide/src/join_lines.rs8
-rw-r--r--crates/ide/src/lib.rs2
-rw-r--r--crates/ide/src/moniker.rs8
-rw-r--r--crates/ide/src/navigation_target.rs4
-rw-r--r--crates/ide/src/prime_caches.rs2
-rw-r--r--crates/ide/src/runnables.rs2
-rw-r--r--crates/ide/src/ssr.rs2
-rw-r--r--crates/ide/src/status.rs2
-rw-r--r--crates/ide/src/syntax_tree.rs2
-rw-r--r--crates/ide/src/typing.rs15
-rw-r--r--crates/ide/src/view_hir.rs2
-rw-r--r--crates/ide/src/view_mir.rs2
17 files changed, 38 insertions, 41 deletions
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs
index f2219857191..ea54734d344 100644
--- a/crates/ide/src/doc_links.rs
+++ b/crates/ide/src/doc_links.rs
@@ -58,7 +58,7 @@ pub(crate) fn rewrite_links(db: &RootDatabase, markdown: &str, definition: Defin
         // and valid URLs so we choose to be too eager to try to resolve what might be
         // a URL.
         if target.contains("://") {
-            (Some(LinkType::Inline), target.to_string(), title.to_string())
+            (Some(LinkType::Inline), target.to_owned(), title.to_owned())
         } else {
             // Two possibilities:
             // * path-based links: `../../module/struct.MyStruct.html`
@@ -66,9 +66,9 @@ pub(crate) fn rewrite_links(db: &RootDatabase, markdown: &str, definition: Defin
             if let Some((target, title)) = rewrite_intra_doc_link(db, definition, target, title) {
                 (None, target, title)
             } else if let Some(target) = rewrite_url_link(db, definition, target) {
-                (Some(LinkType::Inline), target, title.to_string())
+                (Some(LinkType::Inline), target, title.to_owned())
             } else {
-                (None, target.to_string(), title.to_string())
+                (None, target.to_owned(), title.to_owned())
             }
         }
     });
@@ -186,7 +186,7 @@ pub(crate) fn extract_definitions_from_docs(
             let (link, ns) = parse_intra_doc_link(&target);
             Some((
                 TextRange::new(range.start.try_into().ok()?, range.end.try_into().ok()?),
-                link.to_string(),
+                link.to_owned(),
                 ns,
             ))
         }
@@ -388,7 +388,7 @@ fn rewrite_intra_doc_link(
     url = url.join(&file).ok()?;
     url.set_fragment(anchor);
 
-    Some((url.into(), strip_prefixes_suffixes(title).to_string()))
+    Some((url.into(), strip_prefixes_suffixes(title).to_owned()))
 }
 
 /// Try to resolve path to local documentation via path-based links (i.e. `../gateway/struct.Shard.html`).
diff --git a/crates/ide/src/file_structure.rs b/crates/ide/src/file_structure.rs
index b278924721c..0e790e14205 100644
--- a/crates/ide/src/file_structure.rs
+++ b/crates/ide/src/file_structure.rs
@@ -193,7 +193,7 @@ fn structure_token(token: SyntaxToken) -> Option<StructureNode> {
         if let Some(region_name) = text.strip_prefix("// region:").map(str::trim) {
             return Some(StructureNode {
                 parent: None,
-                label: region_name.to_string(),
+                label: region_name.to_owned(),
                 navigation_range: comment.syntax().text_range(),
                 node_range: comment.syntax().text_range(),
                 kind: StructureNodeKind::Region,
diff --git a/crates/ide/src/highlight_related.rs b/crates/ide/src/highlight_related.rs
index 979ca4575d0..dd285e9b327 100644
--- a/crates/ide/src/highlight_related.rs
+++ b/crates/ide/src/highlight_related.rs
@@ -521,7 +521,7 @@ mod tests {
                             ReferenceCategory::Import => "import",
                             ReferenceCategory::Test => "test",
                         }
-                        .to_string()
+                        .to_owned()
                     }),
                 )
             })
diff --git a/crates/ide/src/hover/render.rs b/crates/ide/src/hover/render.rs
index 45386df2b26..eff055c9599 100644
--- a/crates/ide/src/hover/render.rs
+++ b/crates/ide/src/hover/render.rs
@@ -621,7 +621,7 @@ fn closure_ty(
         })
         .join("\n");
     if captures_rendered.trim().is_empty() {
-        captures_rendered = "This closure captures nothing".to_string();
+        captures_rendered = "This closure captures nothing".to_owned();
     }
     let mut targets: Vec<hir::ModuleDef> = Vec::new();
     let mut push_new_def = |item: hir::ModuleDef| {
@@ -823,7 +823,7 @@ fn keyword_hints(
                     }
                 }
                 _ => KeywordHint {
-                    description: token.text().to_string(),
+                    description: token.text().to_owned(),
                     keyword_mod,
                     actions: Vec::new(),
                 },
@@ -835,9 +835,9 @@ fn keyword_hints(
                 Some(_) => format!("prim_{}", token.text()),
                 None => format!("{}_keyword", token.text()),
             };
-            KeywordHint::new(token.text().to_string(), module)
+            KeywordHint::new(token.text().to_owned(), module)
         }
-        T![Self] => KeywordHint::new(token.text().to_string(), "self_upper_keyword".into()),
-        _ => KeywordHint::new(token.text().to_string(), format!("{}_keyword", token.text())),
+        T![Self] => KeywordHint::new(token.text().to_owned(), "self_upper_keyword".into()),
+        _ => KeywordHint::new(token.text().to_owned(), format!("{}_keyword", token.text())),
     }
 }
diff --git a/crates/ide/src/interpret_function.rs b/crates/ide/src/interpret_function.rs
index adbd1918884..df444a3f4d0 100644
--- a/crates/ide/src/interpret_function.rs
+++ b/crates/ide/src/interpret_function.rs
@@ -15,8 +15,8 @@ use syntax::{algo::ancestors_at_offset, ast, AstNode, TextRange};
 // |===
 pub(crate) fn interpret_function(db: &RootDatabase, position: FilePosition) -> String {
     let start_time = Instant::now();
-    let mut result = find_and_interpret(db, position)
-        .unwrap_or_else(|| "Not inside a function body".to_string());
+    let mut result =
+        find_and_interpret(db, position).unwrap_or_else(|| "Not inside a function body".to_owned());
     let duration = Instant::now() - start_time;
     writeln!(result).unwrap();
     writeln!(result, "----------------------").unwrap();
diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs
index 1cfde236245..fef0ec35ba0 100644
--- a/crates/ide/src/join_lines.rs
+++ b/crates/ide/src/join_lines.rs
@@ -115,7 +115,7 @@ fn remove_newline(
 
         let range = TextRange::at(offset, ((n_spaces_after_line_break + 1) as u32).into());
         let replace_with = if no_space { "" } else { " " };
-        edit.replace(range, replace_with.to_string());
+        edit.replace(range, replace_with.to_owned());
         return;
     }
 
@@ -140,7 +140,7 @@ fn remove_newline(
                 };
                 edit.replace(
                     TextRange::new(prev.text_range().start(), token.text_range().end()),
-                    space.to_string(),
+                    space.to_owned(),
                 );
                 return;
             }
@@ -154,7 +154,7 @@ fn remove_newline(
                 Some(_) => cov_mark::hit!(join_two_ifs_with_existing_else),
                 None => {
                     cov_mark::hit!(join_two_ifs);
-                    edit.replace(token.text_range(), " else ".to_string());
+                    edit.replace(token.text_range(), " else ".to_owned());
                     return;
                 }
             }
@@ -203,7 +203,7 @@ fn remove_newline(
     }
 
     // Remove newline but add a computed amount of whitespace characters
-    edit.replace(token.text_range(), compute_ws(prev.kind(), next.kind()).to_string());
+    edit.replace(token.text_range(), compute_ws(prev.kind(), next.kind()).to_owned());
 }
 
 fn join_single_expr_block(edit: &mut TextEditBuilder, token: &SyntaxToken) -> Option<()> {
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index e9f42d47855..effdbf2c1f0 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -238,7 +238,7 @@ impl Analysis {
         let mut host = AnalysisHost::default();
         let file_id = FileId::from_raw(0);
         let mut file_set = FileSet::default();
-        file_set.insert(file_id, VfsPath::new_virtual_path("/main.rs".to_string()));
+        file_set.insert(file_id, VfsPath::new_virtual_path("/main.rs".to_owned()));
         let source_root = SourceRoot::new_local(file_set);
 
         let mut change = Change::new();
diff --git a/crates/ide/src/moniker.rs b/crates/ide/src/moniker.rs
index c49d75b2f81..80d265ae373 100644
--- a/crates/ide/src/moniker.rs
+++ b/crates/ide/src/moniker.rs
@@ -383,18 +383,18 @@ pub(crate) fn def_to_moniker(
             let (name, repo, version) = match krate.origin(db) {
                 CrateOrigin::Library { repo, name } => (name, repo, krate.version(db)),
                 CrateOrigin::Local { repo, name } => (
-                    name.unwrap_or(krate.display_name(db)?.canonical_name().to_string()),
+                    name.unwrap_or(krate.display_name(db)?.canonical_name().to_owned()),
                     repo,
                     krate.version(db),
                 ),
                 CrateOrigin::Rustc { name } => (
                     name.clone(),
-                    Some("https://github.com/rust-lang/rust/".to_string()),
+                    Some("https://github.com/rust-lang/rust/".to_owned()),
                     Some(format!("https://github.com/rust-lang/rust/compiler/{name}",)),
                 ),
                 CrateOrigin::Lang(lang) => (
-                    krate.display_name(db)?.canonical_name().to_string(),
-                    Some("https://github.com/rust-lang/rust/".to_string()),
+                    krate.display_name(db)?.canonical_name().to_owned(),
+                    Some("https://github.com/rust-lang/rust/".to_owned()),
                     Some(match lang {
                         LangCrateOrigin::Other => {
                             "https://github.com/rust-lang/rust/library/".into()
diff --git a/crates/ide/src/navigation_target.rs b/crates/ide/src/navigation_target.rs
index bfd91feeb39..674ce6d52bf 100644
--- a/crates/ide/src/navigation_target.rs
+++ b/crates/ide/src/navigation_target.rs
@@ -860,7 +860,7 @@ fn foo() { enum FooInner { } }
 "#,
         );
 
-        let navs = analysis.symbol_search(Query::new("FooInner".to_string()), !0).unwrap();
+        let navs = analysis.symbol_search(Query::new("FooInner".to_owned()), !0).unwrap();
         expect![[r#"
             [
                 NavigationTarget {
@@ -898,7 +898,7 @@ struct Foo;
 "#,
         );
 
-        let navs = analysis.symbol_search(Query::new("foo".to_string()), !0).unwrap();
+        let navs = analysis.symbol_search(Query::new("foo".to_owned()), !0).unwrap();
         assert_eq!(navs.len(), 2)
     }
 }
diff --git a/crates/ide/src/prime_caches.rs b/crates/ide/src/prime_caches.rs
index a95d1771ce0..5c14f496a0b 100644
--- a/crates/ide/src/prime_caches.rs
+++ b/crates/ide/src/prime_caches.rs
@@ -105,7 +105,7 @@ pub(crate) fn parallel_prime_caches(
             work_sender
                 .send((
                     crate_id,
-                    graph[crate_id].display_name.as_deref().unwrap_or_default().to_string(),
+                    graph[crate_id].display_name.as_deref().unwrap_or_default().to_owned(),
                 ))
                 .ok();
         }
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs
index 3008722cdbb..40b9a5de196 100644
--- a/crates/ide/src/runnables.rs
+++ b/crates/ide/src/runnables.rs
@@ -72,7 +72,7 @@ impl Runnable {
             RunnableKind::Bench { test_id } => format!("bench {test_id}"),
             RunnableKind::DocTest { test_id, .. } => format!("doctest {test_id}"),
             RunnableKind::Bin => {
-                target.map_or_else(|| "run binary".to_string(), |t| format!("run {t}"))
+                target.map_or_else(|| "run binary".to_owned(), |t| format!("run {t}"))
             }
         }
     }
diff --git a/crates/ide/src/ssr.rs b/crates/ide/src/ssr.rs
index f0d18fdefa7..b49fe391bf2 100644
--- a/crates/ide/src/ssr.rs
+++ b/crates/ide/src/ssr.rs
@@ -41,7 +41,7 @@ pub(crate) fn ssr_assists(
     for (label, source_change) in assists.into_iter() {
         let assist = Assist {
             id,
-            label: Label::new(label.to_string()),
+            label: Label::new(label.to_owned()),
             group: Some(GroupLabel("Apply SSR".into())),
             target: comment_range,
             source_change,
diff --git a/crates/ide/src/status.rs b/crates/ide/src/status.rs
index b2b305c1d38..3321a0513b6 100644
--- a/crates/ide/src/status.rs
+++ b/crates/ide/src/status.rs
@@ -105,7 +105,7 @@ pub(crate) fn status(db: &RootDatabase, file_id: Option<FileId>) -> String {
         }
     }
 
-    buf.trim().to_string()
+    buf.trim().to_owned()
 }
 
 fn collect_query<'q, Q>(table: QueryTable<'q, Q>) -> <Q as QueryCollect>::Collector
diff --git a/crates/ide/src/syntax_tree.rs b/crates/ide/src/syntax_tree.rs
index 2108b53861c..1065d5899ab 100644
--- a/crates/ide/src/syntax_tree.rs
+++ b/crates/ide/src/syntax_tree.rs
@@ -55,7 +55,7 @@ fn syntax_tree_for_string(token: &SyntaxToken, text_range: TextRange) -> Option<
 fn syntax_tree_for_token(node: &SyntaxToken, text_range: TextRange) -> Option<String> {
     // Range of the full node
     let node_range = node.text_range();
-    let text = node.text().to_string();
+    let text = node.text().to_owned();
 
     // We start at some point inside the node
     // Either we have selected the whole string
diff --git a/crates/ide/src/typing.rs b/crates/ide/src/typing.rs
index b8856882ed7..e87fc89fea2 100644
--- a/crates/ide/src/typing.rs
+++ b/crates/ide/src/typing.rs
@@ -149,10 +149,7 @@ fn on_opening_bracket_typed(
 
         let tree: ast::UseTree = find_node_at_offset(file.syntax(), offset)?;
 
-        Some(TextEdit::insert(
-            tree.syntax().text_range().end() + TextSize::of("{"),
-            "}".to_string(),
-        ))
+        Some(TextEdit::insert(tree.syntax().text_range().end() + TextSize::of("{"), "}".to_owned()))
     }
 
     fn bracket_expr(
@@ -235,7 +232,7 @@ fn on_eq_typed(file: &SourceFile, offset: TextSize) -> Option<TextEdit> {
             return None;
         }
         let offset = expr.syntax().text_range().end();
-        Some(TextEdit::insert(offset, ";".to_string()))
+        Some(TextEdit::insert(offset, ";".to_owned()))
     }
 
     /// `a =$0 b;` removes the semicolon if an expression is valid in this context.
@@ -275,7 +272,7 @@ fn on_eq_typed(file: &SourceFile, offset: TextSize) -> Option<TextEdit> {
             return None;
         }
         let offset = let_stmt.syntax().text_range().end();
-        Some(TextEdit::insert(offset, ";".to_string()))
+        Some(TextEdit::insert(offset, ";".to_owned()))
     }
 }
 
@@ -353,7 +350,7 @@ fn on_left_angle_typed(file: &SourceFile, offset: TextSize) -> Option<ExtendedTe
     if let Some(t) = file.syntax().token_at_offset(offset).left_biased() {
         if T![impl] == t.kind() {
             return Some(ExtendedTextEdit {
-                edit: TextEdit::replace(range, "<$0>".to_string()),
+                edit: TextEdit::replace(range, "<$0>".to_owned()),
                 is_snippet: true,
             });
         }
@@ -363,7 +360,7 @@ fn on_left_angle_typed(file: &SourceFile, offset: TextSize) -> Option<ExtendedTe
         ast::GenericParamList::can_cast(n.kind()) || ast::GenericArgList::can_cast(n.kind())
     }) {
         Some(ExtendedTextEdit {
-            edit: TextEdit::replace(range, "<$0>".to_string()),
+            edit: TextEdit::replace(range, "<$0>".to_owned()),
             is_snippet: true,
         })
     } else {
@@ -383,7 +380,7 @@ fn on_right_angle_typed(file: &SourceFile, offset: TextSize) -> Option<TextEdit>
     }
     find_node_at_offset::<ast::RetType>(file.syntax(), offset)?;
 
-    Some(TextEdit::insert(after_arrow, " ".to_string()))
+    Some(TextEdit::insert(after_arrow, " ".to_owned()))
 }
 
 #[cfg(test)]
diff --git a/crates/ide/src/view_hir.rs b/crates/ide/src/view_hir.rs
index 9abe54cd390..51cf45bd22b 100644
--- a/crates/ide/src/view_hir.rs
+++ b/crates/ide/src/view_hir.rs
@@ -12,7 +12,7 @@ use syntax::{algo::ancestors_at_offset, ast, AstNode};
 // |===
 // image::https://user-images.githubusercontent.com/48062697/113065588-068bdb80-91b1-11eb-9a78-0b4ef1e972fb.gif[]
 pub(crate) fn view_hir(db: &RootDatabase, position: FilePosition) -> String {
-    body_hir(db, position).unwrap_or_else(|| "Not inside a function body".to_string())
+    body_hir(db, position).unwrap_or_else(|| "Not inside a function body".to_owned())
 }
 
 fn body_hir(db: &RootDatabase, position: FilePosition) -> Option<String> {
diff --git a/crates/ide/src/view_mir.rs b/crates/ide/src/view_mir.rs
index 08d810c1346..5fb47039890 100644
--- a/crates/ide/src/view_mir.rs
+++ b/crates/ide/src/view_mir.rs
@@ -11,7 +11,7 @@ use syntax::{algo::ancestors_at_offset, ast, AstNode};
 // | VS Code | **rust-analyzer: View Mir**
 // |===
 pub(crate) fn view_mir(db: &RootDatabase, position: FilePosition) -> String {
-    body_mir(db, position).unwrap_or_else(|| "Not inside a function body".to_string())
+    body_mir(db, position).unwrap_or_else(|| "Not inside a function body".to_owned())
 }
 
 fn body_mir(db: &RootDatabase, position: FilePosition) -> Option<String> {