From 0353e1c6f4eb0f9351f9a75f5fef016d6ac7960b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 17:12:37 +0100 Subject: Use Arguments::from_os --- crates/ra_cli/src/main.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/crates/ra_cli/src/main.rs b/crates/ra_cli/src/main.rs index 750cbab86..f0daaaf15 100644 --- a/crates/ra_cli/src/main.rs +++ b/crates/ra_cli/src/main.rs @@ -40,16 +40,10 @@ impl Verbosity { fn main() -> Result<()> { env_logger::try_init()?; - let subcommand = match std::env::args_os().nth(1) { - None => { - eprintln!("{}", help::GLOBAL_HELP); - return Ok(()); - } - Some(s) => s, - }; - let mut matches = Arguments::from_vec(std::env::args_os().skip(2).collect()); + let mut matches = Arguments::from_env(); + let subcommand = matches.subcommand()?.unwrap_or_default(); - match &*subcommand.to_string_lossy() { + match subcommand.as_str() { "parse" => { if matches.contains(["-h", "--help"]) { eprintln!("{}", help::PARSE_HELP); -- cgit v1.2.3