ruff/crates/ruff_linter
Aarni Koskela 491a51960e
[ruff] Support slices in RUF005 (#17078)
## 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.
2025-03-31 09:09:39 -04:00
..
resources [ruff] Support slices in RUF005 (#17078) 2025-03-31 09:09:39 -04:00
src [ruff] Support slices in RUF005 (#17078) 2025-03-31 09:09:39 -04:00
Cargo.toml Bump 0.11.2 (#16896) 2025-03-21 09:17:07 -04:00