rustdoc: Repersent --output-format=json coverage and ir diferently#154445
Open
aDotInTheVoid wants to merge 1 commit intorust-lang:mainfrom
Open
rustdoc: Repersent --output-format=json coverage and ir diferently#154445aDotInTheVoid wants to merge 1 commit intorust-lang:mainfrom
--output-format=json coverage and ir diferently#154445aDotInTheVoid wants to merge 1 commit intorust-lang:mainfrom
Conversation
`--output-format=json` does a few different things:
- By itself, it emits a JSON representation of a crate's API ("IR
JSON").
- When used with `--show-coverage`, it prints the doc coverage as JSON,
instead of a ascii table ("Coverage JSON").
These two cases need to be handled entirely differently. There's no
overlapping code, they just are called the same way.
By making these seperate variants, we don't need to check the
`show_coverage` variable each time we check `is_json`, which makes it
harder to write a bug that checks for IR JSON, and accidently happens in
coverage JSON too.
Also, as a driveby, improves some instability error messages, and cleans
up their tests, and adds a test for the unknown output format case.
Collaborator
|
r? @notriddle rustbot has assigned @notriddle. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--output-format=jsondoes a few different things:--show-coverage, it prints the doc coverage as JSON, instead of a ascii table ("Coverage JSON").These two cases need to be handled entirely differently. There's no overlapping code, they just are called the same way.
By making these seperate variants, we don't need to check the
show_coveragevariable each time we checkis_json, which makes it harder to write a bug that checks for IR JSON, and accidently happens in coverage JSON too.Also, as a driveby, improves some instability error messages, and cleans up their tests, and adds a test for the unknown output format case.