diff --git a/proxmox-async/src/io/async_channel_writer.rs b/proxmox-async/src/io/async_channel_writer.rs index 697e65bd..9dd64cd5 100644 --- a/proxmox-async/src/io/async_channel_writer.rs +++ b/proxmox-async/src/io/async_channel_writer.rs @@ -12,7 +12,7 @@ use tokio::io::AsyncWrite; use tokio::sync::mpsc::Sender; use proxmox_io::ByteBuffer; -use proxmox_lang::{error::io_err_other, io_format_err}; +use proxmox_lang::io_format_err; /// Wrapper around tokio::sync::mpsc::Sender, which implements Write pub struct AsyncChannelWriter { @@ -62,7 +62,7 @@ impl AsyncChannelWriter { let sender = match self.sender.take() { Some(sender) => sender, - None => return Poll::Ready(Err(io_err_other("no sender"))), + None => return Poll::Ready(Err(io_format_err!("no sender"))), }; let data = self.buf.remove_data(self.buf.len()).to_vec(); diff --git a/proxmox-sys/src/error.rs b/proxmox-sys/src/error.rs index 74377659..908cd5f4 100644 --- a/proxmox-sys/src/error.rs +++ b/proxmox-sys/src/error.rs @@ -17,8 +17,6 @@ use std::io; use nix::errno::Errno; -use proxmox_lang::error::io_err_other; - /// This trait should be implemented for error types which can represent system errors. Note that /// it is discouraged to try to map non-system errors to with this trait, since users of this trait /// assume there to be a relation between the error code and a previous system call. For instance, @@ -146,7 +144,7 @@ macro_rules! other_error { #[inline] fn into_io_result(self) -> io::Result { - self.map_err($crate::error::io_err_other) + self.map_err(::std::io::Error::other) } } }; diff --git a/proxmox-sys/src/linux/pid.rs b/proxmox-sys/src/linux/pid.rs index 4407c82f..7d50ac44 100644 --- a/proxmox-sys/src/linux/pid.rs +++ b/proxmox-sys/src/linux/pid.rs @@ -11,8 +11,6 @@ use nix::sys::stat::Mode; use nix::unistd::Pid; use nix::NixPath; -use proxmox_lang::error::io_err_other; - use crate::error::SysResult; use crate::linux::procfs::{MountInfo, PidStat}; use crate::{c_result, c_try}; @@ -109,13 +107,13 @@ impl PidFd { /// Get the `PidStat` structure for this process. (`/proc/PID/stat`) pub fn get_stat(&self) -> io::Result { let data = self.read_file(c"stat")?; - let data = String::from_utf8(data).map_err(io_err_other)?; - PidStat::parse(&data).map_err(io_err_other) + let data = String::from_utf8(data).map_err(io::Error::other)?; + PidStat::parse(&data).map_err(io::Error::other) } /// Read this process' `/proc/PID/mountinfo` file. pub fn get_mount_info(&self) -> io::Result { - MountInfo::parse(&self.read_file(c"mountinfo")?).map_err(io_err_other) + MountInfo::parse(&self.read_file(c"mountinfo")?).map_err(io::Error::other) } /// Attempt to get a `PidFd` from a raw file descriptor. diff --git a/proxmox-sys/src/mmap.rs b/proxmox-sys/src/mmap.rs index 1ce19e5c..0ba5337b 100644 --- a/proxmox-sys/src/mmap.rs +++ b/proxmox-sys/src/mmap.rs @@ -6,10 +6,9 @@ use std::num::NonZeroUsize; use std::os::unix::io::RawFd; use std::{io, mem}; -use anyhow::format_err; use nix::sys::mman; -use proxmox_lang::error::io_err_other; +use proxmox_lang::io_format_err; use crate::error::SysError; @@ -35,7 +34,7 @@ impl Mmap { flags: mman::MapFlags, ) -> io::Result { let byte_len = NonZeroUsize::new(count * mem::size_of::()) - .ok_or(io_err_other(format_err!("mapped length must not be zero")))?; + .ok_or_else(|| io_format_err!("mapped length must not be zero"))?; // libc::size_t vs usize #[allow(clippy::useless_conversion)] @@ -45,7 +44,7 @@ impl Mmap { prot, flags, fd, - libc::off_t::try_from(ofs).map_err(io_err_other)?, + libc::off_t::try_from(ofs).map_err(io::Error::other)?, ) .map_err(SysError::into_io_error)?;