Skip to content

Commit cd61d37

Browse files
committed
Simplify and satisfy clippy
1 parent 0c39710 commit cd61d37

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

rewatch/src/main.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,17 @@ fn parse_cli(raw_args: Vec<String>) -> Result<cli::Cli, clap::Error> {
134134
}
135135

136136
fn should_default_to_build(err: &clap::Error, args: &[String]) -> bool {
137-
let first_non_global = first_non_global_arg(args);
138-
139137
match err.kind() {
140-
ErrorKind::MissingSubcommand | ErrorKind::DisplayHelpOnMissingArgumentOrSubcommand => {
138+
ErrorKind::MissingSubcommand
139+
| ErrorKind::DisplayHelpOnMissingArgumentOrSubcommand
140+
| ErrorKind::UnknownArgument
141+
| ErrorKind::InvalidSubcommand => {
142+
let first_non_global = first_non_global_arg(args);
141143
match first_non_global {
142144
Some(arg) => !is_known_subcommand(arg),
143145
None => true,
144146
}
145147
}
146-
ErrorKind::UnknownArgument | ErrorKind::InvalidSubcommand => match first_non_global {
147-
Some(arg) if is_known_subcommand(arg) => false,
148-
_ => true,
149-
},
150148
_ => false,
151149
}
152150
}

0 commit comments

Comments
 (0)