From 6cbf913db3439b2e35ac42195478a1401bb6f29b Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Wed, 16 Feb 2022 20:04:19 -0800 Subject: [PATCH] Tidy up subcommand logic slightly --- src/bin/cargo/cli.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bin/cargo/cli.rs b/src/bin/cargo/cli.rs index 4b12881cf17..465d6abd2c0 100644 --- a/src/bin/cargo/cli.rs +++ b/src/bin/cargo/cli.rs @@ -44,10 +44,9 @@ pub fn main(config: &mut Config) -> CliResult { (ContextKind::InvalidSubcommand, &ContextValue::String(ref cmd)) => { Some(cmd) } - (ContextKind::InvalidSubcommand, _) => unreachable!(), _ => None, }) - .unwrap(); + .expect("UnrecognizedSubcommand implies the presence of InvalidSubcommand"); return super::execute_external_subcommand(config, &cmd, &[&cmd, "--help"]) .map_err(|_| e.into()); } else {