mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-25 17:38:15 +00:00
## Summary When linting, we store a map from file path to fixes, which we then use to show a fix summary in the printer. In the printer, we assume that if the map is non-empty, then we have at least one fix. But this isn't enforced by the fix struct, since you can have an entry from (file path) to (empty fix table). In practice, this only bites us when linting from `stdin`, since when linting across multiple files, we have an `AddAssign` on `Diagnostics` that avoids adding empty entries to the map. When linting from `stdin`, we create the map directly, and so it _is_ possible to have a non-empty map that doesn't contain any fixes, leading to a panic. This PR introduces a dedicated struct to make these constraints part of the formal interface. Closes https://github.com/astral-sh/ruff/issues/8027. ## Test Plan `cargo test` (notice two failures are removed) |
||
|---|---|---|
| .. | ||
| resources/test/fixtures | ||
| src | ||
| tests | ||
| Cargo.toml | ||