From 3e86ef647e48368311dc58954a875e7edadfd4ef Mon Sep 17 00:00:00 2001 From: Artyom Pavlov Date: Thu, 19 Dec 2024 00:22:03 +0300 Subject: [PATCH] Apply review suggestion --- src/error.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/error.rs b/src/error.rs index 7328506f..4004af57 100644 --- a/src/error.rs +++ b/src/error.rs @@ -79,15 +79,13 @@ impl Error { #[inline] pub fn raw_os_error(self) -> Option { let code = self.0.get(); - if code < Self::INTERNAL_START { - let res = RawOsError::try_from(code).ok(); - // On SOLID, negate the error code again to obtain the original error code. - #[cfg(target_os = "solid_asp3")] - let res = res.map(|errno| -errno); - res - } else { - None + if code >= Self::INTERNAL_START { + return None; } + let errno = RawOsError::try_from(code).ok()?; + #[cfg(target_os = "solid_asp3")] + let errno = -errno; + Some(errno) } /// Creates a new instance of an `Error` from a particular custom error code.