diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 04c6dd2f20686..6e9d5421c2482 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -443,9 +443,7 @@ fn wrap_return(diag: &rustc_errors::Handler, res: Result<(), String>) -> MainRes match res { Ok(()) => Ok(()), Err(err) => { - if !err.is_empty() { - diag.struct_err(&err).emit(); - } + diag.struct_err(&err).emit(); Err(ErrorReported) } } @@ -478,7 +476,7 @@ fn main_options(options: config::Options) -> MainResult { match (options.should_test, options.markdown_input()) { (true, true) => return wrap_return(&diag, markdown::test(options)), - (true, false) => return wrap_return(&diag, test::run(options)), + (true, false) => return test::run(options), (false, true) => { return wrap_return( &diag, diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index e8ea71997109a..d8d5136fd9bef 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -42,7 +42,7 @@ pub struct TestOptions { pub attrs: Vec, } -pub fn run(options: Options) -> Result<(), String> { +pub fn run(options: Options) -> Result<(), ErrorReported> { let input = config::Input::File(options.input.clone()); let invalid_codeblock_attributes_name = rustc_lint::builtin::INVALID_CODEBLOCK_ATTRIBUTES.name; @@ -150,7 +150,7 @@ pub fn run(options: Options) -> Result<(), String> { }); let tests = match tests { Ok(tests) => tests, - Err(ErrorReported) => return Err(String::new()), + Err(ErrorReported) => return Err(ErrorReported), }; test_args.insert(0, "rustdoctest".to_string());