You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use clap::{Parser,Subcommand};#[derive(Parser,Debug)]structOpt{#[clap(subcommand)]cmd:Option<Cmds>,}#[derive(Subcommand,Debug)]enumCmds{#[clap(subcommand)]One(OneCmd),}#[derive(Subcommand,Debug)]enumOneCmd{Add{name:String,items:Vec<String>},}fnmain(){Opt::parse();}
Steps to reproduce the bug with the above code
cargo clippy
Actual Behaviour
❯ cargo clippy
Checking app v.0.1.0 (/tmp/wat)
warning: this looks like an `else if` but the `else` is missing
--> src/main.rs:17:15
|
17 | Add { name: String, items: Vec<String> },
| ^^^^^^^^^^
|
= note: `#[warn(clippy::suspicious_else_formatting)]` on by default
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting
warning: this looks like an `else if` but the `else` is missing
--> src/main.rs:17:11
|
17 | Add { name: String, items: Vec<String> },
| ^^^^^^^^^^^^^^^^^^^
|
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting
warning: this looks like an `else if` but the `else` is missing
--> src/main.rs:17:15
|
17 | Add { name: String, items: Vec<String> },
| ^^^^^^^^^^
|
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting
Expected Behaviour
No warnings are displayed.
Additional Context
No response
Debug Output
No response
The text was updated successfully, but these errors were encountered:
Thanks for reporting this! Its now resolved in master. I wish there was a better way of handling warnings in macros, it feels very reactionary. We don't want to blanket disable all because there are some that might highlight a legitimate issue in our code or user code.
I wonder if macro authors have collaborated at all in sharing the most annoying warnings for code gen...
Please complete the following tasks
Rust Version
rustc 1.56.1 (59eed8a2a 2021-11-01)
Clap Version
clap = "3.0.0-beta.5"
Minimal reproducible code
Steps to reproduce the bug with the above code
cargo clippy
Actual Behaviour
Expected Behaviour
No warnings are displayed.
Additional Context
No response
Debug Output
No response
The text was updated successfully, but these errors were encountered: