Skip to content

Commit beda84e

Browse files
djcrami3l
authored andcommitted
Tweak SanitizedOutput style
1 parent 6b57e4b commit beda84e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/test/mock/clitools.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::{
1212
ops::{Deref, DerefMut},
1313
path::{Path, PathBuf},
1414
process::Command,
15+
string::FromUtf8Error,
1516
sync::{Arc, LazyLock, RwLock, RwLockWriteGuard},
1617
time::Instant,
1718
};
@@ -764,7 +765,7 @@ impl Config {
764765
};
765766
let duration = Instant::now() - start;
766767
let status = out.status;
767-
let output: SanitizedOutput = out.try_into().unwrap();
768+
let output = SanitizedOutput::try_from(out).unwrap();
768769

769770
println!("ran: {} {:?}", name, args);
770771
println!("inprocess: {inprocess}");
@@ -918,14 +919,14 @@ pub struct SanitizedOutput {
918919
}
919920

920921
impl TryFrom<Output> for SanitizedOutput {
921-
type Error = std::string::FromUtf8Error;
922+
type Error = FromUtf8Error;
923+
922924
fn try_from(out: Output) -> Result<Self, Self::Error> {
923-
let sanitized_output = Self {
925+
Ok(Self {
924926
ok: matches!(out.status, Some(0)),
925927
stdout: String::from_utf8(out.stdout)?,
926928
stderr: String::from_utf8(out.stderr)?,
927-
};
928-
Ok(sanitized_output)
929+
})
929930
}
930931
}
931932

0 commit comments

Comments
 (0)