ruff
46fe1776 - Pass `Checker` by immutable reference to lint rules (#16012)

Commit
220 days ago
Pass `Checker` by immutable reference to lint rules (#16012) This very large PR changes the field `.diagnostics` in the `Checker` from a `Vec<Diagnostic>` to a `RefCell<Vec<Diagnostic>>`, adds methods to push new diagnostics to this cell, and then removes unnecessary mutability throughout all of our lint rule implementations. Consequently, the compiler may now enforce what was, till now, the _convention_ that the only changes to the `Checker` that can happen during a lint are the addition of diagnostics[^1]. The PR is best reviewed commit-by-commit. I have tried to keep the large commits limited to "bulk actions that you can easily see are performing the same find/replace on a large number of files", and separate anything ad-hoc or with larger diffs. Please let me know if there's anything else I can do to make this easier to review! Many thanks to [`ast-grep`](https://github.com/ast-grep/ast-grep), [`helix`](https://github.com/helix-editor/helix), and good ol' fashioned`git` magic, without which this PR would have taken the rest of my natural life. [^1]: And randomly also the seen variables violating `flake8-bugbear`?
Author
Parents
Loading