mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-31 07:37:38 +00:00
Create a newtype wrapper around Vec<FStringElement>
(#11400)
## Summary This PR adds a newtype wrapper around `Vec<FStringElement>` that derefs to a `&Vec<FStringElement>`. Both f-string and format specifier are made up of `Vec<FStringElement>`. By creating a newtype wrapper around it, we can share the methods for both parent types.
This commit is contained in:
parent
0dc130e841
commit
4b41e4de7f
15 changed files with 71 additions and 39 deletions
|
@ -128,6 +128,7 @@ impl FStringLayout {
|
|||
//
|
||||
// Reference: https://prettier.io/docs/en/next/rationale.html#template-literals
|
||||
if f_string
|
||||
.elements
|
||||
.expressions()
|
||||
.any(|expr| memchr::memchr2(b'\n', b'\r', locator.slice(expr).as_bytes()).is_some())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue