mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Preserve raw string prefix and escapes (#15694)
## Summary Fixes #9663 and also improves the fixes for [RUF055](https://docs.astral.sh/ruff/rules/unnecessary-regular-expression/) since regular expressions are often written as raw strings. This doesn't include raw f-strings. ## Test Plan Existing snapshots for RUF055 and PT009, plus a new `Generator` test and a regression test for the reported `PIE810` issue.
This commit is contained in:
parent
569060f46c
commit
cffd1866ce
7 changed files with 65 additions and 18 deletions
|
@ -24,6 +24,14 @@ impl Quote {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn as_str(self) -> &'static str {
|
||||
match self {
|
||||
Self::Single => "'",
|
||||
Self::Double => "\"",
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
#[inline]
|
||||
pub const fn opposite(self) -> Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue