Skip to content

Commit 98104aa

Browse files
committed
Fixed clippy errors
1 parent 42d2c73 commit 98104aa

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

src/commands/sub_process.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ fn execute_sub_process(
8585
if status.code() == Some(0) {
8686
Ok(())
8787
} else {
88-
Err(std::io::Error::new(
89-
std::io::ErrorKind::Other,
90-
format!("Command failed with {}", status),
91-
))
88+
Err(std::io::Error::other(format!(
89+
"Command failed with {}",
90+
status
91+
)))
9292
}
9393
}
94-
Err(err) => Err(std::io::Error::new(
95-
std::io::ErrorKind::Other,
96-
format!("Shell execution failed: {}", err),
97-
)),
94+
Err(err) => Err(std::io::Error::other(format!(
95+
"Shell execution failed: {}",
96+
err
97+
))),
9898
}
9999
}
100100
SubprocessCallMode::Spawn => {
@@ -114,10 +114,10 @@ fn execute_sub_process(
114114
Some(String::from_utf8_lossy(&output.stdout).to_string());
115115
Ok(())
116116
} else {
117-
Err(std::io::Error::new(
118-
std::io::ErrorKind::Other,
119-
format!("Command failed with {}", output.status),
120-
))
117+
Err(std::io::Error::other(format!(
118+
"Command failed with {}",
119+
output.status
120+
)))
121121
}
122122
}
123123
}

src/types/state/preview_state.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ impl PreviewState {
8989
.and_then(|dyn_img| {
9090
picker
9191
.new_protocol(dyn_img, rect, Resize::Fit(None))
92-
.map_err(|err| {
93-
io::Error::new(io::ErrorKind::Other, format!("{err}"))
94-
})
92+
.map_err(|err| io::Error::other(format!("{err}")))
9593
});
9694
if let Ok(proto) = proto {
9795
let ev = AppEvent::PreviewFile {
@@ -159,13 +157,13 @@ impl PreviewState {
159157
} else {
160158
AppEvent::PreviewFile {
161159
path,
162-
res: Err(io::Error::new(io::ErrorKind::Other, "nonzero status")),
160+
res: Err(io::Error::other("nonzero status")),
163161
}
164162
}
165163
}
166164
Err(err) => AppEvent::PreviewFile {
167165
path,
168-
res: Err(io::Error::new(io::ErrorKind::Other, format!("{err}"))),
166+
res: Err(io::Error::other(format!("{err}"))),
169167
},
170168
};
171169
let _ = thread_event_tx.send(res);
@@ -260,7 +258,7 @@ impl PreviewState {
260258

261259
#[inline]
262260
fn map_io_err(err: impl Error) -> io::Error {
263-
io::Error::new(io::ErrorKind::Other, format!("{err}"))
261+
io::Error::other(format!("{err}"))
264262
}
265263
}
266264

0 commit comments

Comments
 (0)