mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-22 11:25:26 +00:00
![]() ## Summary This PR removes the `Iterator::chain(...)` sequence in `RuleCodePrefix::iter()` with `Vec::expand` to avoid an overlong-recursive types. The existing `RuleCodePrefix::iter` method chains all rule group iterators together. This leads to very long recursive types `Chain<Map<Chain<Map<Chain<Map.....>>>>` (proportional to the number of rule groups). This PR rewrites the macro to use `Vec::extend` instead, which removes the long recursive type (at the cost of introducing a potential allocation). ## Alternatives An alternative would be to use a stack allocated array by unrolling the `Linter::iter` methods (generated by `EnumIter`). I don't think it's worth the extra complexity, considering that `RuleCodePrefix::iter` isn't a hot function. ## Test Plan `cargo test` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |