Skip to content

Commit a3219f1

Browse files
committed
Fixes for clippy 1.87.
1 parent d96bb45 commit a3219f1

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/vision/mnist.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ fn read_u32<T: Read>(reader: &mut T) -> Result<u32> {
1818
fn check_magic_number<T: Read>(reader: &mut T, expected: u32) -> Result<()> {
1919
let magic_number = read_u32(reader)?;
2020
if magic_number != expected {
21-
return Err(io::Error::new(
22-
io::ErrorKind::Other,
23-
format!("incorrect magic number {magic_number} != {expected}"),
24-
));
21+
return Err(io::Error::other(format!(
22+
"incorrect magic number {magic_number} != {expected}"
23+
)));
2524
}
2625
Ok(())
2726
}

src/wrappers/utils.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ pub(super) fn path_to_cstring<T: AsRef<std::path::Path>>(
4848
let path = path.as_ref();
4949
match path.to_str() {
5050
Some(path) => Ok(std::ffi::CString::new(path)?),
51-
None => Err(TchError::Io(io::Error::new(
52-
io::ErrorKind::Other,
53-
format!("path {path:?} cannot be converted to UTF-8"),
54-
))),
51+
None => Err(TchError::Io(io::Error::other(format!(
52+
"path {path:?} cannot be converted to UTF-8"
53+
)))),
5554
}
5655
}
5756

0 commit comments

Comments
 (0)