From 341795c1ee6fb6feb7951cc92fa3d6b0f37b065d Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 23 Apr 2020 12:43:29 +0200 Subject: [PATCH] Revert "proxmox: add SysError::is_errno_raw" Not actually required, the numbers just overlapped and are therefore no separate enum entry. This reverts commit 8f57f29ca84dbfdb99a822fdfbba43b361577a81. --- proxmox/src/sys/error.rs | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/proxmox/src/sys/error.rs b/proxmox/src/sys/error.rs index 65bc7183..7adfed78 100644 --- a/proxmox/src/sys/error.rs +++ b/proxmox/src/sys/error.rs @@ -55,13 +55,7 @@ pub fn io_err_other(e: E) -> io::Error { /// ``` pub trait SysError { /// Check if this error is a specific error returned from a system call. - fn is_errno(&self, value: Errno) -> bool { - self.is_errno_raw(value as i32) - } - - /// Check if this error is a specific error returned from a system call, without involving the - /// `nix::errno::Errno` type as it is incomplete. - fn is_errno_raw(&self, value: i32) -> bool; + fn is_errno(&self, value: Errno) -> bool; /// Convert this error into a `std::io::Error`. This must use the correct `std::io::ErrorKind`, /// so that for example `ErrorKind::WouldBlock` means that the previous system call failed with @@ -89,8 +83,8 @@ pub trait SysError { impl SysError for io::Error { #[inline] - fn is_errno_raw(&self, value: i32) -> bool { - self.raw_os_error() == Some(value) + fn is_errno(&self, value: Errno) -> bool { + self.raw_os_error() == Some(value as i32) } #[inline] @@ -105,14 +99,6 @@ impl SysError for nix::Error { *self == Error::Sys(value) } - #[inline] - fn is_errno_raw(&self, value: i32) -> bool { - match *self { - Error::Sys(errno) => value == errno as i32, - _ => false, - } - } - #[inline] fn into_io_error(self) -> io::Error { match self {