ruff
0dc130e8 - Add `Iterator` impl for `StringLike` parts (#11399)

Commit
1 year ago
Add `Iterator` impl for `StringLike` parts (#11399) ## Summary This PR adds support to iterate over each part of a string-like expression. This similar to the one in the formatter: https://github.com/astral-sh/ruff/blob/128414cd9507adc45584189f025363793dd7cd94/crates/ruff_python_formatter/src/string/any.rs#L121-L125 Although I don't think it's a 1-1 replacement in the formatter because the one implemented in the formatter has another information for certain variants (as can be seen for `FString`). The main motivation for this is to avoid duplication for rules which work only on the parts of the string and doesn't require any information from the parent node. Here, the parent node being the expression node which could be an implicitly concatenated string. This PR also updates certain rule implementation to make use of this and avoids logic duplication.
Author
Parents
Loading