mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Remove some unneeded string allocations
This commit is contained in:
parent
a9814fa9c0
commit
816190c6f6
@ -234,7 +234,7 @@ fn parse_comma_sep_input(derive_input: ast::TokenTree) -> Result<FxHashSet<Strin
|
|||||||
current_derive = String::new();
|
current_derive = String::new();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
current_derive.push_str(token.to_string().trim());
|
current_derive.push_str(token.text().trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ mod diagnostics {
|
|||||||
});
|
});
|
||||||
for token in tokens {
|
for token in tokens {
|
||||||
if token.kind() == SyntaxKind::IDENT
|
if token.kind() == SyntaxKind::IDENT
|
||||||
&& token.to_string() == *name
|
&& token.text() == name.as_str()
|
||||||
{
|
{
|
||||||
precise_location = Some(token.text_range());
|
precise_location = Some(token.text_range());
|
||||||
break 'outer;
|
break 'outer;
|
||||||
|
@ -473,7 +473,9 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
|
|||||||
}
|
}
|
||||||
SyntaxElement::Node(n) => {
|
SyntaxElement::Node(n) => {
|
||||||
if let Some(first_token) = n.first_token() {
|
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() {
|
if let Some(SyntaxElement::Node(p)) = pattern.next() {
|
||||||
// We have a subtree that starts with the next token in our pattern.
|
// We have a subtree that starts with the next token in our pattern.
|
||||||
self.attempt_match_token_tree(phase, &p, &n)?;
|
self.attempt_match_token_tree(phase, &p, &n)?;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user