mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 05:26:23 +00:00
![]() ## Summary We use `.trim()` and friends in a bunch of places, to strip whitespace from source code. However, not all Unicode whitespace characters are considered "whitespace" in Python, which only supports the standard space, tab, and form-feed characters. This PR audits our usages of `.trim()`, `.trim_start()`, `.trim_end()`, and `char::is_whitespace`, and replaces them as appropriate with a new `.trim_whitespace()` analogues, powered by a `PythonWhitespace` trait. In general, the only place that should continue to use `.trim()` is content within docstrings, which don't need to adhere to Python's semantic definitions of whitespace. Closes #4991. |
||
---|---|---|
.. | ||
comments | ||
expression | ||
module | ||
other | ||
pattern | ||
snapshots | ||
statement | ||
builders.rs | ||
cli.rs | ||
context.rs | ||
generated.rs | ||
lib.rs | ||
main.rs | ||
prelude.rs | ||
trivia.rs |