diff options
| author | Emanuel Czirai <zazdxscf@gmail.com> | 2015-10-25 11:48:56 +0100 |
|---|---|---|
| committer | Emanuel Czirai <zazdxscf@gmail.com> | 2015-10-25 11:53:47 +0100 |
| commit | 351efd55e90332d0b045324774ffc987d549c0a8 (patch) | |
| tree | 55ba8bd246663a7188eebfe8617fd6f5a2087d02 | |
| parent | 04e497c0056aed899cd6edbc98e7a68a9b391c5c (diff) | |
| download | rust-351efd55e90332d0b045324774ffc987d549c0a8.tar.gz rust-351efd55e90332d0b045324774ffc987d549c0a8.zip | |
compiletest: show usage/help when passed no args
instead of this panic: ``` thread '<main>' panicked at 'index out of bounds: the len is 1 but the index is 1', src/libcollections/vec.rs:1110 ``` It still panics, just like `-h` does, so it should be okay in this regard.
| -rw-r--r-- | src/compiletest/compiletest.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 0e928345d93..fd7540634c8 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -92,7 +92,7 @@ pub fn parse_config(args: Vec<String> ) -> Config { optflag("h", "help", "show this message")); let (argv0, args_) = args.split_first().unwrap(); - if args[1] == "-h" || args[1] == "--help" { + if args.len() == 1 || args[1] == "-h" || args[1] == "--help" { let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); println!("{}", getopts::usage(&message, &groups)); println!(""); |
