Skip to content

Commit 46414fd

Browse files
generatedunixname89002005320881meta-codesync[bot]
authored andcommitted
[QuickReview][Codemod][Lint:fbsource:RUSTFIX:clippy::io_other_error] Fix clippy::io_other_error issues in fbcode/antlir/antlir2/antlir2_vm/src
Reviewed By: dtolnay Differential Revision: D89443569 fbshipit-source-id: 9b2c71b0a3254e7d54f04094f522d34d0dde91a7
1 parent 99b77f6 commit 46414fd

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

antlir/antlir2/antlir2_vm/src/utils.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,21 @@ pub(crate) fn log_command(command: &mut Command) -> &mut Command {
3838
/// finish fast.
3939
pub(crate) fn run_command_capture_output(command: &mut Command) -> Result<(), std::io::Error> {
4040
let output = log_command(command).output()?;
41-
let stdout = String::from_utf8(output.stdout).map_err(|e| {
42-
std::io::Error::new(ErrorKind::Other, format!("Failed to decode stdout: {e}"))
43-
})?;
44-
let stderr = String::from_utf8(output.stderr).map_err(|e| {
45-
std::io::Error::new(ErrorKind::Other, format!("Failed to decode stderr: {e}"))
46-
})?;
41+
let stdout = String::from_utf8(output.stdout)
42+
.map_err(|e| std::io::Error::other(format!("Failed to decode stdout: {e}")))?;
43+
let stderr = String::from_utf8(output.stderr)
44+
.map_err(|e| std::io::Error::other(format!("Failed to decode stderr: {e}")))?;
4745
if !output.status.success() {
4846
error!(
4947
"Command {} failed\nStdout: {}\nStderr: {}",
5048
command.get_program().to_string_lossy(),
5149
stdout,
5250
stderr
5351
);
54-
return Err(std::io::Error::new(
55-
ErrorKind::Other,
56-
format!("Failed to execute command: {:?}", command),
57-
));
52+
return Err(std::io::Error::other(format!(
53+
"Failed to execute command: {:?}",
54+
command
55+
)));
5856
}
5957
if !stdout.is_empty() {
6058
debug!(stdout);

antlir/antlir2/antlir2_vm/src/vm.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -351,19 +351,13 @@ impl<S: Share> VM<S> {
351351
let msg = format!("Sidecar service at index {} finished unexpectedly", i);
352352
error!("{}", &msg);
353353
let status = x.join().map_err(|e| {
354-
VMError::SidecarError(std::io::Error::new(
355-
ErrorKind::Other,
356-
format!(
357-
"Failed to join thread for sidecar service at index {}: {:?}",
358-
i, e
359-
),
360-
))
354+
VMError::SidecarError(std::io::Error::other(format!(
355+
"Failed to join thread for sidecar service at index {}: {:?}",
356+
i, e
357+
)))
361358
})?;
362359
error!("Exit status {:#?}", status);
363-
return Err(VMError::SidecarError(std::io::Error::new(
364-
ErrorKind::Other,
365-
msg,
366-
)));
360+
return Err(VMError::SidecarError(std::io::Error::other(msg)));
367361
}
368362
Ok(())
369363
})

0 commit comments

Comments
 (0)