Skip to content

Commit 8a1af70

Browse files
sstanglweihanglo
andcommitted
Simplify check_alias() using flatten()
Co-authored-by: Weihang Lo <[email protected]>
1 parent dc0bc58 commit 8a1af70

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/bin/cargo/commands/help.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ fn try_help(config: &Config) -> CargoResult<bool> {
8585
///
8686
/// Returns None if it is not an alias.
8787
fn check_alias(config: &Config, subcommand: &str) -> Option<Vec<String>> {
88-
match aliased_command(config, subcommand) {
89-
Ok(Some(alias)) => Some(alias),
90-
_ => None,
91-
}
88+
aliased_command(config, subcommand).ok().flatten()
9289
}
9390

9491
/// Checks if the given subcommand is a built-in command (not via an alias).

0 commit comments

Comments
 (0)