ruff/crates/ruff_linter
Steve C f6b6f0df67
[ruff] Fix panic in unused # noqa removal with multi-byte space (RUF100) (#10682)
## Summary

Currently, [this
line](716688d44e/crates/ruff_linter/src/fix/edits.rs (L101))
assumes that the `noqa` comment begins with an octothorpe followed by a
space. (`# `) With anyone's random code, this of course is not always
true.

When there's a multi-byte character after the leading octothorpe, such
as
[`\u0085`](https://www.fileformat.info/info/unicode/char/85/index.htm),
we try slicing from within the character, causing a panic.

To fix this, the logic has been changed to remove unused `noqa`
directives and keep any trailing comments, or removing the whole comment
if the comment is just the unused `noqa`

Fixes #10097.

## Test Plan

`cargo test`
2024-04-01 01:00:37 +00:00
..
resources [ruff] Fix panic in unused # noqa removal with multi-byte space (RUF100) (#10682) 2024-04-01 01:00:37 +00:00
src [ruff] Fix panic in unused # noqa removal with multi-byte space (RUF100) (#10682) 2024-04-01 01:00:37 +00:00
__init__.py [pylint] (Re-)Implement import-private-name (C2701) (#9553) 2024-01-16 14:03:11 -05:00
Cargo.toml Bump version to v0.3.4 (#10515) 2024-03-21 18:08:21 +00:00