]> git.lizzy.rs Git - rust.git/commitdiff
Don't panic if we have tidy errors.
authorCorey Farwell <coreyf@rwell.org>
Sun, 19 Mar 2017 15:22:48 +0000 (11:22 -0400)
committerCorey Farwell <coreyf@rwell.org>
Sun, 2 Apr 2017 00:59:45 +0000 (20:59 -0400)
Otherwise we get the standard Rust panic message alongside "some tidy
checks failed" which seems unnecessary.

src/tools/tidy/src/main.rs

index 501e35e03e8a70e971fb827c2155304e54045911..d0e8cf9c343dcb83550bd5fda1aa41a3cf06570f 100644 (file)
 
 extern crate regex;
 
+use std::env;
 use std::fs;
+use std::io::{self, Write};
 use std::path::{PathBuf, Path};
-use std::env;
+use std::process;
 
 macro_rules! t {
     ($e:expr, $p:expr) => (match $e {
@@ -60,7 +62,8 @@ fn main() {
     }
 
     if bad {
-        panic!("some tidy checks failed");
+        writeln!(io::stderr(), "some tidy checks failed").expect("could not write to stderr");
+        process::exit(1);
     }
 }