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/ssr/src/matching.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates/ssr/src') diff --git a/crates/ssr/src/matching.rs b/crates/ssr/src/matching.rs index 99b187311..6cf831431 100644 --- a/crates/ssr/src/matching.rs +++ b/crates/ssr/src/matching.rs @@ -473,7 +473,9 @@ impl<'db, 'sema> 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