ruff/crates/ruff_linter
Loïc Riegel 2d3466eccf
[`flake8-bugbear`] Accept immutable slice default arguments (`B008`) (#21823)
Closes issue #21565

## Summary

As pointed out in the issue, slices are currently flagged by B008 but
this behavior is incorrect because slices are immutable.

## Test Plan

Added a test case in the "B006_B008.py" fixture. Sorry for the diff in
the snapshots, the only thing that changes in those flies is the line
numbers, though.

You can also test this manually with this file:
```py
# test_slice.py
def c(d=slice(0, 3)): ...
```

```sh
> target/debug/ruff check tmp/test_slice.py --no-cache --select B008
All checks passed!
```
2025-12-08 14:00:43 -05:00
..
resources [`flake8-bugbear`] Accept immutable slice default arguments (`B008`) (#21823) 2025-12-08 14:00:43 -05:00
src [`flake8-bugbear`] Accept immutable slice default arguments (`B008`) (#21823) 2025-12-08 14:00:43 -05:00
Cargo.toml Bump 0.14.8 (#21791) 2025-12-04 09:45:53 -05:00