From 01e83a362ca2eee456e222e72cc6b65b951920dc Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Wed, 21 Jun 2017 11:15:49 -0600 Subject: [PATCH] Don't allocate args in order to run find. --- src/bootstrap/flags.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index dc9dac73627..cb455ca6a14 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -122,16 +122,15 @@ pub fn parse(args: &[String]) -> Flags { // the subcommand. Therefore we must manually identify the subcommand first, so that we can // complete the definition of the options. Then we can use the getopt::Matches object from // there on out. - let mut possible_subcommands = args.iter().collect::>(); - possible_subcommands.retain(|&s| - (s == "build") - || (s == "test") - || (s == "bench") - || (s == "doc") - || (s == "clean") - || (s == "dist") - || (s == "install")); - let subcommand = match possible_subcommands.first() { + let subcommand = args.iter().find(|&s| + (s == "build") + || (s == "test") + || (s == "bench") + || (s == "doc") + || (s == "clean") + || (s == "dist") + || (s == "install")); + let subcommand = match subcommand { Some(s) => s, None => { // No subcommand -- show the general usage and subcommand help -- 2.44.0