diff options
Diffstat (limited to 'rola-utils/functions/src/copy_with_temp_rename/async.rs')
| -rw-r--r-- | rola-utils/functions/src/copy_with_temp_rename/async.rs | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/rola-utils/functions/src/copy_with_temp_rename/async.rs b/rola-utils/functions/src/copy_with_temp_rename/async.rs index 83275a1..33f7693 100644 --- a/rola-utils/functions/src/copy_with_temp_rename/async.rs +++ b/rola-utils/functions/src/copy_with_temp_rename/async.rs @@ -35,29 +35,23 @@ async fn internal_copy_with_temp_rename(src: &Path, dst: &Path) -> io::Result<() } } (Err(e), _) | (_, Err(e)) => { - return Err(io::Error::new( - io::ErrorKind::Other, - format!( - "failed to canonicalize paths (src: {}, dst: {}): {}", - src.display(), - dst.display(), - e - ), - )); + return Err(io::Error::other(format!( + "failed to canonicalize paths (src: {}, dst: {}): {}", + src.display(), + dst.display(), + e + ))); } } } else { // dst doesn't exist yet, so it cannot be the same file as src // If src canonicalization fails, propagate the error let _ = src_canonical.map_err(|e| { - io::Error::new( - io::ErrorKind::Other, - format!( - "failed to canonicalize source path (src: {}): {}", - src.display(), - e - ), - ) + io::Error::other(format!( + "failed to canonicalize source path (src: {}): {}", + src.display(), + e + )) })?; } @@ -215,8 +209,7 @@ async fn atomic_create_temp(dir: &Path, base: &str) -> io::Result<PathBuf> { } } - Err(io::Error::new( - io::ErrorKind::Other, + Err(io::Error::other( "exceeded max attempts to create temp file", )) } |
