mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 23:57:35 +00:00
Remove unnecessary string cloning from the parser (#9884)
Closes https://github.com/astral-sh/ruff/issues/9869.
This commit is contained in:
parent
7ca515c0aa
commit
6f0e4ad332
11 changed files with 227 additions and 119 deletions
|
@ -1616,7 +1616,7 @@ StringLiteralOrFString: StringType = {
|
|||
StringLiteral: StringType = {
|
||||
<location:@L> <string:string> <end_location:@R> =>? {
|
||||
let (source, kind, triple_quoted) = string;
|
||||
Ok(parse_string_literal(&source, kind, triple_quoted, (location..end_location).into())?)
|
||||
Ok(parse_string_literal(source, kind, triple_quoted, (location..end_location).into())?)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1633,7 +1633,7 @@ FStringMiddlePattern: ast::FStringElement = {
|
|||
FStringReplacementField,
|
||||
<location:@L> <fstring_middle:fstring_middle> <end_location:@R> =>? {
|
||||
let (source, is_raw, _) = fstring_middle;
|
||||
Ok(parse_fstring_literal_element(&source, is_raw, (location..end_location).into())?)
|
||||
Ok(parse_fstring_literal_element(source, is_raw, (location..end_location).into())?)
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue