Skip to content

Commit c46721f

Browse files
authored
Fix clippy::io_other_error lint in newer Rust (#937)
The `clippy::io_other_error` lint has been added to Rust beta: https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error ``` warning: this can be `std::io::Error::other(_)` --> libherokubuildpack/src/fs.rs:33:28 | 33 | ...|| std::io::Error::new(ErrorKind::Other, "std::fs::read_dir unexpectedly returned an entry that is not in the directory that was read."))?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error = note: `#[warn(clippy::io_other_error)]` on by default help: use `std::io::Error::other` | 33 - .ok_or_else(|| std::io::Error::new(ErrorKind::Other, "std::fs::read_dir unexpectedly returned an entry that is not in the directory that was read."))?; 33 + .ok_or_else(|| std::io::Error::other("std::fs::read_dir unexpectedly returned an entry that is not in the directory that was read."))?; | ``` GUS-W-18337923.
1 parent de6205b commit c46721f

File tree

1 file changed

+1
-2
lines changed
  • libherokubuildpack/src

1 file changed

+1
-2
lines changed

libherokubuildpack/src/fs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::fs;
2-
use std::io::ErrorKind;
32
use std::path::Path;
43

54
/// Moves all contents of a directory into another directory, leaving `src_dir` empty.
@@ -30,7 +29,7 @@ pub fn move_directory_contents(
3029
for dir_entry in fs::read_dir(src_dir.as_ref())? {
3130
let dir_entry = dir_entry?;
3231
let relative_path = pathdiff::diff_paths(dir_entry.path(), src_dir.as_ref())
33-
.ok_or_else(|| std::io::Error::new(ErrorKind::Other, "std::fs::read_dir unexpectedly returned an entry that is not in the directory that was read."))?;
32+
.ok_or_else(|| std::io::Error::other("std::fs::read_dir unexpectedly returned an entry that is not in the directory that was read."))?;
3433

3534
fs::rename(dir_entry.path(), dst_dir.as_ref().join(relative_path))?;
3635
}

0 commit comments

Comments
 (0)