mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 13:34:40 +00:00
Reduce Result<Tok, LexicalError>
size by using Box<str>
instead of String
(#9885)
This commit is contained in:
parent
9027169125
commit
fe7d965334
22 changed files with 454 additions and 425 deletions
|
@ -95,19 +95,22 @@ impl Transformer for Normalizer {
|
|||
&string_literal.value,
|
||||
"<DOCTEST-CODE-SNIPPET: Removed by normalizer>\n",
|
||||
)
|
||||
.into_owned();
|
||||
.into_owned()
|
||||
.into_boxed_str();
|
||||
string_literal.value = STRIP_RST_BLOCKS
|
||||
.replace_all(
|
||||
&string_literal.value,
|
||||
"<RSTBLOCK-CODE-SNIPPET: Removed by normalizer>\n",
|
||||
)
|
||||
.into_owned();
|
||||
.into_owned()
|
||||
.into_boxed_str();
|
||||
string_literal.value = STRIP_MARKDOWN_BLOCKS
|
||||
.replace_all(
|
||||
&string_literal.value,
|
||||
"<MARKDOWN-CODE-SNIPPET: Removed by normalizer>\n",
|
||||
)
|
||||
.into_owned();
|
||||
.into_owned()
|
||||
.into_boxed_str();
|
||||
// Normalize a string by (2) stripping any leading and trailing space from each
|
||||
// line, and (3) removing any blank lines from the start and end of the string.
|
||||
string_literal.value = string_literal
|
||||
|
@ -117,6 +120,7 @@ impl Transformer for Normalizer {
|
|||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
.trim()
|
||||
.to_owned();
|
||||
.to_owned()
|
||||
.into_boxed_str();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue