Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept flag without value where cargo rustc does a dedicated error message #141

Merged
merged 2 commits into from
May 4, 2022

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented May 4, 2022

Before:

$ cargo expand --test
error: The argument '--test <NAME>' requires a value but none was supplied

USAGE:
    cargo expand [OPTIONS] [ITEM]

For more information try --help

After:

$ cargo expand --test
error: "--test" takes one argument.
Available tests:
    compiletest
    test_autotrait
    test_backtrace
    test_boxed
    test_chain
    test_context
    test_convert
    test_downcast
    test_ensure
    test_ffi
    test_fmt
    test_macros
    test_repr
    test_source

    error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
      --> src/opts.rs:41:14
       |
    41 |     pub bin: Option<Option<String>>,
       |              ^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: `-D clippy::option-option` implied by `-D clippy::pedantic`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_option

    error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
      --> src/opts.rs:45:18
       |
    45 |     pub example: Option<Option<String>>,
       |                  ^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_option

    error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
      --> src/opts.rs:49:15
       |
    49 |     pub test: Option<Option<String>>,
       |               ^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_option

    error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
      --> src/opts.rs:57:16
       |
    57 |     pub bench: Option<Option<String>>,
       |                ^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_option

    error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
      --> src/opts.rs:79:18
       |
    79 |     pub package: Option<Option<String>>,
       |                  ^^^^^^^^^^^^^^^^^^^^^^
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_option
@dtolnay dtolnay merged commit aaa28b5 into master May 4, 2022
@dtolnay dtolnay deleted the minvalues branch May 4, 2022 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant