ide-ssr: Fix warnings about clippy str_to_string rule

This commit is contained in:
Tetsuharu Ohzeki 2024-02-10 00:49:00 +09:00
parent fb8c0f514e
commit ae78dcae75
2 changed files with 3 additions and 3 deletions

View File

@ -456,7 +456,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
SyntaxElement::Token(t) => Some(t.clone()), SyntaxElement::Token(t) => Some(t.clone()),
SyntaxElement::Node(n) => n.first_token(), SyntaxElement::Node(n) => n.first_token(),
}) })
.map(|p| p.text().to_string()); .map(|p| p.text().to_owned());
let first_matched_token = child.clone(); let first_matched_token = child.clone();
let mut last_matched_token = child; let mut last_matched_token = child;
// Read code tokens util we reach one equal to the next token from our pattern // Read code tokens util we reach one equal to the next token from our pattern
@ -795,7 +795,7 @@ mod tests {
let edits = match_finder.edits(); let edits = match_finder.edits();
assert_eq!(edits.len(), 1); assert_eq!(edits.len(), 1);
let edit = &edits[&position.file_id]; let edit = &edits[&position.file_id];
let mut after = input.to_string(); let mut after = input.to_owned();
edit.apply(&mut after); edit.apply(&mut after);
assert_eq!(after, "fn foo() {} fn bar() {} fn main() { bar(1+2); }"); assert_eq!(after, "fn foo() {} fn bar() {} fn main() { bar(1+2); }");
} }

View File

@ -152,7 +152,7 @@ impl FromStr for SsrRule {
.next() .next()
.ok_or_else(|| SsrError("Cannot find delimiter `==>>`".into()))? .ok_or_else(|| SsrError("Cannot find delimiter `==>>`".into()))?
.trim() .trim()
.to_string(); .to_owned();
if it.next().is_some() { if it.next().is_some() {
return Err(SsrError("More than one delimiter found".into())); return Err(SsrError("More than one delimiter found".into()));
} }