Skip to content

Commit

Permalink
minor: Remove intermediate allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Oct 24, 2024
1 parent 7147bc9 commit 38e9da2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/tools/rust-analyzer/crates/hir/src/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/ide-ssr/src/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 38e9da2

Please sign in to comment.