Expand and remove try_something macro.
Since 2f6226518b
there has been only one invocation.
This commit is contained in:
parent
2113659479
commit
12785dd89c
1 changed files with 7 additions and 13 deletions
|
@ -8,18 +8,6 @@ use rustc_errors::Handler;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
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)]
|
#[derive(Debug, Clone, Eq)]
|
||||||
pub struct CssPath {
|
pub struct CssPath {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
@ -265,7 +253,13 @@ pub fn test_theme_against<P: AsRef<Path>>(
|
||||||
against: &CssPath,
|
against: &CssPath,
|
||||||
diag: &Handler,
|
diag: &Handler,
|
||||||
) -> (bool, Vec<String>) {
|
) -> (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 paths = load_css_paths(&data);
|
||||||
let mut ret = vec![];
|
let mut ret = vec![];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue