diff --git a/src/content/write.rs b/src/content/write.rs index 980ec65..aa0b6b5 100644 --- a/src/content/write.rs +++ b/src/content/write.rs @@ -491,20 +491,18 @@ fn make_mmap(tmpfile: &mut NamedTempFile, size: Option) -> Result std::io::Result<()> { - use std::io::{Error, ErrorKind}; + use std::io::Error; use std::os::fd::AsRawFd; let fd = file.as_raw_fd(); match unsafe { libc::posix_fallocate64(fd, 0, size as i64) } { 0 => Ok(()), - libc::ENOSPC => Err(Error::new( - ErrorKind::Other, // ErrorKind::StorageFull is unstable + libc::ENOSPC => Err(Error::other( "cannot allocate file: no space left on device", )), - err => Err(Error::new( - ErrorKind::Other, - format!("posix_fallocate64 failed with code {err}"), - )), + err => Err(Error::other(format!( + "posix_fallocate64 failed with code {err}" + ))), } } diff --git a/src/errors.rs b/src/errors.rs index ccb864d..3cef1ed 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -59,5 +59,5 @@ impl IoErrorExt for std::result::Result { } pub fn io_error(err: impl Into>) -> std::io::Error { - std::io::Error::new(std::io::ErrorKind::Other, err) + std::io::Error::other(err) }