From a9f037bd407a3add4ee90559f3f69e0c8e9512f9 Mon Sep 17 00:00:00 2001 From: Christian Haynes <06chaynes@gmail.com> Date: Wed, 23 Jul 2025 13:02:43 -0400 Subject: [PATCH] fix: clippy io_other_error --- src/content/write.rs | 12 +++++------- src/errors.rs | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) 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) }