]> git.lizzy.rs Git - rust.git/commitdiff
improve `compiletest` error message when path option missing.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Mon, 22 Dec 2014 18:02:11 +0000 (19:02 +0100)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Thu, 5 Feb 2015 22:58:32 +0000 (23:58 +0100)
(I often run `compiletest` by hand by cut-and-pasting from what `make`
runs, but then I need to tweak it (cut out options) and its useful to
be told when I have removed an option that is actually required, such
as `--android-cross-path=path`.)

src/compiletest/compiletest.rs

index e3e7ca7691134a6f150c72f6d080d5ffd9b67d11..e6d2a691cf5630467f1edf4aef3b12b756be7eb2 100644 (file)
@@ -118,7 +118,10 @@ pub fn parse_config(args: Vec<String> ) -> Config {
     }
 
     fn opt_path(m: &getopts::Matches, nm: &str) -> Path {
-        Path::new(m.opt_str(nm).unwrap())
+        match m.opt_str(nm) {
+            Some(s) => Path::new(s),
+            None => panic!("no option (=path) found for {}", nm),
+        }
     }
 
     let filter = if !matches.free.is_empty() {