From bd698b9e8b02e27409123e71c0594523b926b850 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sun, 19 Mar 2017 11:22:48 -0400 Subject: [PATCH] Don't panic if we have tidy errors. Otherwise we get the standard Rust panic message alongside "some tidy checks failed" which seems unnecessary. --- src/tools/tidy/src/main.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 501e35e03e8a..d0e8cf9c343d 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -16,9 +16,11 @@ extern crate regex; -use std::fs; -use std::path::{PathBuf, Path}; use std::env; +use std::fs; +use std::io::{self, Write}; +use std::path::{PathBuf, Path}; +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); } }