about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2024-10-24 11:48:27 +0000
committerGitHub <noreply@github.com>2024-10-24 11:48:27 +0000
commit7e67a18c745e51d70e3fe08133d7e89dc6941585 (patch)
treed99552281466e20e29b74c726290543f260688ee
parent3c75b4a0172267d32fc6bed7a45f084c4c7ed617 (diff)
parent38e9da2068c8fffbfd3eafc78c2be2608e7d2492 (diff)
downloadrust-7e67a18c745e51d70e3fe08133d7e89dc6941585.tar.gz
rust-7e67a18c745e51d70e3fe08133d7e89dc6941585.zip
Merge pull request #18401 from Veykril/veykril/push-ulpowvsymyys
minor: Remove intermediate allocations
-rw-r--r--src/tools/rust-analyzer/crates/hir/src/symbols.rs3
-rw-r--r--src/tools/rust-analyzer/crates/ide-ssr/src/parsing.rs2
2 files changed, 2 insertions, 3 deletions
diff --git a/src/tools/rust-analyzer/crates/hir/src/symbols.rs b/src/tools/rust-analyzer/crates/hir/src/symbols.rs
index cabb7e3db3d..e2ad0081e3a 100644
--- a/src/tools/rust-analyzer/crates/hir/src/symbols.rs
+++ b/src/tools/rust-analyzer/crates/hir/src/symbols.rs
@@ -214,8 +214,7 @@ impl<'a> SymbolCollector<'a> {
 
     fn collect_from_impl(&mut self, impl_id: ImplId) {
         let impl_data = self.db.impl_data(impl_id);
-        let impl_name =
-            Some(SmolStr::new(impl_data.self_ty.display(self.db, self.edition).to_string()));
+        let impl_name = Some(impl_data.self_ty.display(self.db, self.edition).to_smolstr());
         self.with_container_name(impl_name, |s| {
             for &assoc_item_id in impl_data.items.iter() {
                 s.push_assoc_item(assoc_item_id)
diff --git a/src/tools/rust-analyzer/crates/ide-ssr/src/parsing.rs b/src/tools/rust-analyzer/crates/ide-ssr/src/parsing.rs
index e752ee3d775..ea40d5b815e 100644
--- a/src/tools/rust-analyzer/crates/ide-ssr/src/parsing.rs
+++ b/src/tools/rust-analyzer/crates/ide-ssr/src/parsing.rs
@@ -190,7 +190,7 @@ impl RawPattern {
         let mut res = FxHashMap::default();
         for t in &self.tokens {
             if let PatternElement::Placeholder(placeholder) = t {
-                res.insert(SmolStr::new(placeholder.stand_in_name.clone()), placeholder.clone());
+                res.insert(SmolStr::new(&placeholder.stand_in_name), placeholder.clone());
             }
         }
         res