1
Fork 0

Rollup merge of #70706 - gizmondo:check-theme, r=GuillaumeGomez

Minor cleanup in rustdoc --check-theme

Expand and remove try_something macro. Since 2f6226518b there has been only one invocation.

r? @GuillaumeGomez
This commit is contained in:
Dylan DPC 2020-04-03 13:31:24 +02:00 committed by GitHub
commit 5082fe21a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,18 +8,6 @@ use rustc_errors::Handler;
#[cfg(test)]
mod tests;
macro_rules! try_something {
($e:expr, $diag:expr, $out:expr) => {{
match $e {
Ok(c) => c,
Err(e) => {
$diag.struct_err(&e.to_string()).emit();
return $out;
}
}
}};
}
#[derive(Debug, Clone, Eq)]
pub struct CssPath {
pub name: String,
@ -265,7 +253,13 @@ pub fn test_theme_against<P: AsRef<Path>>(
against: &CssPath,
diag: &Handler,
) -> (bool, Vec<String>) {
let data = try_something!(fs::read(f), diag, (false, vec![]));
let data = match fs::read(f) {
Ok(c) => c,
Err(e) => {
diag.struct_err(&e.to_string()).emit();
return (false, vec![]);
}
};
let paths = load_css_paths(&data);
let mut ret = vec![];