Reduce again the number of match calls (#7815)

- Reduce the number of match calls (see commit messages)
- A few miscellaneous improvements
This commit is contained in:
Hofer-Julian
2023-01-24 12:23:42 +01:00
committed by GitHub
parent 0bb2e47c98
commit 41306aa7e0
49 changed files with 467 additions and 634 deletions

View File

@ -36,9 +36,5 @@ pub fn with_locale_override<T>(locale_string: &str, func: fn() -> T) -> T {
result
};
match result {
Ok(result) => result,
Err(err) => std::panic::resume_unwind(err),
}
result.unwrap_or_else(|err| std::panic::resume_unwind(err))
}

View File

@ -99,17 +99,14 @@ impl Executable for Director {
}
}
let process = match binary
let process = binary
.construct()
.stdout(Stdio::piped())
// .stdin(Stdio::piped())
.stderr(Stdio::piped())
.arg(format!("-c '{}'", commands))
.spawn()
{
Ok(child) => child,
Err(why) => panic!("Can't run test {}", why),
};
.expect("It should be possible to run tests");
process
.wait_with_output()

View File

@ -48,10 +48,8 @@ impl CheckerMatchers for Play {
Some(out) => out,
None => return Ok(()),
};
let actual = match str::from_utf8(actual) {
Err(..) => return Err(format!("{} was not utf8 encoded", description)),
Ok(actual) => actual,
};
let actual =
str::from_utf8(actual).map_err(|_| format!("{} was not utf8 encoded", description))?;
if actual != *out {
return Err(format!(