mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 02:24:58 +02:00
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:
@ -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))
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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!(
|
||||
|
Reference in New Issue
Block a user