Skip to content

Commit d2fd725

Browse files
committed
Lint: Fix future clippy::io_other_error.
1 parent ef88fe7 commit d2fd725

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

all-is-cubes-port/src/gltf/buffer.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ impl GltfDataDestination {
116116
// TODO: Only do this if we exceed the in-memory limit?
117117
let unique_file_suffix: String = {
118118
let mut suffix_uses = self.0.suffix_uses.lock().map_err(|_| {
119-
io::Error::new(
120-
io::ErrorKind::Other,
121-
"previous panic while using GltfDataDestination",
122-
)
119+
io::Error::other("previous panic while using GltfDataDestination")
123120
})?;
124121
make_unique_name(proposed_file_name, &mut suffix_uses)
125122
};
@@ -259,10 +256,9 @@ impl io::Write for SwitchingWriter {
259256
let n = buffer.write(bytes)?;
260257
if buffer.len() > limit {
261258
let path = path.as_ref().ok_or_else(|| {
262-
io::Error::new(
263-
io::ErrorKind::Other,
264-
format!("no destination was provided for glTF buffers > {limit} bytes"),
265-
)
259+
io::Error::other(format!(
260+
"no destination was provided for glTF buffers > {limit} bytes"
261+
))
266262
})?;
267263
// TODO: refuse to overwrite existing files unless we are also overwriting a corresponding .gltf
268264
let file = File::create(path)?;

all-is-cubes-port/src/native.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(crate) fn import_native_json(
2424
detail: if error.is_eof() || error.is_io() {
2525
ImportErrorKind::Read {
2626
path: None,
27-
error: io::Error::new(io::ErrorKind::Other, error),
27+
error: io::Error::other(error),
2828
}
2929
} else {
3030
ImportErrorKind::Parse(Box::new(error))
@@ -43,7 +43,7 @@ pub(crate) async fn export_native_json(
4343
let ExportSet { contents } = source;
4444
serde_json::to_writer(destination, &contents).map_err(|error| {
4545
// TODO: report non-IO errors distinctly
46-
ExportError::Write(io::Error::new(io::ErrorKind::Other, error))
46+
ExportError::Write(io::Error::other(error))
4747
})?;
4848
progress.finish().await;
4949
Ok(())

0 commit comments

Comments
 (0)