Merge pull request #18401 from Veykril/veykril/push-ulpowvsymyys

minor: Remove intermediate allocations
This commit is contained in:
Lukas Wirth 2024-10-24 11:48:27 +00:00 committed by GitHub
commit 7e67a18c74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -214,8 +214,7 @@ fn collect_from_body(&mut self, body_id: impl Into<DefWithBodyId>) {
fn collect_from_impl(&mut self, impl_id: ImplId) { fn collect_from_impl(&mut self, impl_id: ImplId) {
let impl_data = self.db.impl_data(impl_id); let impl_data = self.db.impl_data(impl_id);
let impl_name = let impl_name = Some(impl_data.self_ty.display(self.db, self.edition).to_smolstr());
Some(SmolStr::new(impl_data.self_ty.display(self.db, self.edition).to_string()));
self.with_container_name(impl_name, |s| { self.with_container_name(impl_name, |s| {
for &assoc_item_id in impl_data.items.iter() { for &assoc_item_id in impl_data.items.iter() {
s.push_assoc_item(assoc_item_id) s.push_assoc_item(assoc_item_id)

View File

@ -190,7 +190,7 @@ pub(crate) fn placeholders_by_stand_in(&self) -> FxHashMap<SmolStr, Placeholder>
let mut res = FxHashMap::default(); let mut res = FxHashMap::default();
for t in &self.tokens { for t in &self.tokens {
if let PatternElement::Placeholder(placeholder) = t { 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 res