Improve error for nightly-only '--message-format' args#6780
Open
matthewhughes934 wants to merge 1 commit intorust-lang:mainfrom
Open
Improve error for nightly-only '--message-format' args#6780matthewhughes934 wants to merge 1 commit intorust-lang:mainfrom
matthewhughes934 wants to merge 1 commit intorust-lang:mainfrom
Conversation
Previously on a stable build (`json` is only supported in `nightly`
builds):
$ cargo fmt --message-format json
Invalid value for `--emit` - using an unstable value without `--unstable-features`
With this change:
$ CFG_RELEASE_CHANNEL=stable cargo make bin-build
$ PATH="./target/debug:$PATH" cargo fmt --message-format json
--message-format json is only supported in nightly builds
This utility formats all bin and lib files of the current crate using rustfmt.
<-- SNIP: the rest of the usage follows -->
This behaviour is similar to how args to `--emit` are handled in
`rustfmt`.
This change also drops displaying `json` as an option to
`--message-format` on stable builds:
$ PATH="./target/debug:$PATH" cargo fmt --help | grep --max-count 1 --after-context 1 message-format
--message-format <message-format>
Specify message-format: short|human
This required rewriting the check for nightly builds (copying from the
one in `src/release_channel.rs`) to be `const` so I could rewrite the
`--message-format` flag's help string.
Issue: rust-lang#6752
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.
Previously on a stable build (
jsonis only supported innightlybuilds):With this change:
This behaviour is similar to how args to
--emitare handled inrustfmt.This change also drops displaying
jsonas an option to--message-formaton stable builds:This required rewriting the check for nightly builds (copying from the one in
src/release_channel.rs) to beconstso I could rewrite the--message-formatflag's help string.Issue: #6752