diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2017-06-21 11:15:49 -0600 |
|---|---|---|
| committer | Mark Simulacrum <mark.simulacrum@gmail.com> | 2017-07-04 07:31:55 -0600 |
| commit | 01e83a362ca2eee456e222e72cc6b65b951920dc (patch) | |
| tree | d20a771b43d67fd63ca53f281e06004d49e83354 /src/bootstrap/flags.rs | |
| parent | 7a75d2bec402b76688da35402575aa7d8e61d91c (diff) | |
| download | rust-01e83a362ca2eee456e222e72cc6b65b951920dc.tar.gz rust-01e83a362ca2eee456e222e72cc6b65b951920dc.zip | |
Don't allocate args in order to run find.
Diffstat (limited to 'src/bootstrap/flags.rs')
| -rw-r--r-- | src/bootstrap/flags.rs | 19 |
1 files 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 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`"); // 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::<Vec<_>>(); - 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 |
