From 816190c6f6838f163acc4bbe6a06c302c99535b2 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 31 Dec 2020 10:13:14 +0100 Subject: Remove some unneeded string allocations --- crates/completion/src/completions/attribute.rs | 2 +- crates/hir_def/src/nameres.rs | 2 +- crates/ssr/src/matching.rs | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'crates') diff --git a/crates/completion/src/completions/attribute.rs b/crates/completion/src/completions/attribute.rs index 19ce2482f..8695eed39 100644 --- a/crates/completion/src/completions/attribute.rs +++ b/crates/completion/src/completions/attribute.rs @@ -234,7 +234,7 @@ fn parse_comma_sep_input(derive_input: ast::TokenTree) -> Result Matcher<'db, 'sema> { } SyntaxElement::Node(n) => { if let Some(first_token) = n.first_token() { - if Some(first_token.to_string()) == next_pattern_token { + if Some(first_token.text().as_str()) + == next_pattern_token.as_deref() + { if let Some(SyntaxElement::Node(p)) = pattern.next() { // We have a subtree that starts with the next token in our pattern. self.attempt_match_token_tree(phase, &p, &n)?; -- cgit v1.2.3