mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 10:23:11 +00:00
![]() ## Summary Teaches `RUF005` to also consider slices for concatenation. Other indexing (`foo[0] + [7, 8, 9] + bar[1]`) is explicitly not considered. ```diff foo = [4, 5, 6] -bar = [1, 2, 3] + foo -slicing1 = foo[:1] + [7, 8, 9] -slicing2 = [7, 8, 9] + bar[1:] -slicing3 = foo[:1] + [7, 8, 9] + bar[1:] +bar = [1, 2, 3, *foo] +slicing1 = [*foo[:1], 7, 8, 9] +slicing2 = [7, 8, 9, *bar[1:]] +slicing3 = [*foo[:1], 7, 8, 9, *bar[1:]] ``` ## Test Plan Manually tested (diff above from `ruff check --diff`), snapshot updated. |
||
---|---|---|
.. | ||
resources | ||
src | ||
Cargo.toml |