ruff
dc5e9222 - [`flake8-comprehensions`] Handle extraneous parentheses around list comprehension (`C403`) (#15877)

Comment changes are shownComment changes are hidden
Commit
152 days ago
[`flake8-comprehensions`] Handle extraneous parentheses around list comprehension (`C403`) (#15877) ## Summary Given the following code: ```python set(([x for x in range(5)])) ``` the current implementation of C403 results in ```python {(x for x in range(5))} ``` which is a set containing a generator rather than the result of the generator. This change removes the extraneous parentheses so that the resulting code is: ```python {x for x in range(5)} ``` ## Test Plan `cargo nextest run` and `cargo insta test`
Author
Parents
  • crates/ruff_linter
    • resources/test/fixtures/flake8_comprehensions
      • File
        C403.py
    • src/rules/flake8_comprehensions
      • rules
        • File
          unnecessary_list_comprehension_set.rs
      • snapshots
        • ruff_linter__rules__flake8_comprehensions__tests__C403_C403.py.snap