-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid failed assertion when showing fixes from stdin (#8029)
## 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 #8027. ## Test Plan `cargo test` (notice two failures are removed)
- Loading branch information
1 parent
a62c735
commit 195c000
Showing
3 changed files
with
51 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters