Skip to content

Commit

Permalink
Fix the error handling on modern Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
MOZGIII committed Dec 25, 2022
1 parent 3a88cd8 commit f757366
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions efivar/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn is_variable_not_found_error(err: &io::Error) -> bool {

#[cfg(target_os = "windows")]
fn is_variable_not_found_error(err: &io::Error) -> bool {
err.kind() == io::ErrorKind::Other && err.raw_os_error() == Some(203)
err.raw_os_error() == Some(203)
}

#[cfg(not(target_os = "windows"))]
Expand All @@ -49,7 +49,7 @@ fn is_buffer_too_small_error(_err: &io::Error) -> bool {

#[cfg(target_os = "windows")]
fn is_buffer_too_small_error(err: &io::Error) -> bool {
err.kind() == io::ErrorKind::Other && err.raw_os_error() == Some(122)
err.raw_os_error() == Some(122)
}

#[cfg(not(target_os = "windows"))]
Expand All @@ -59,7 +59,7 @@ fn is_permission_denied_error(err: &io::Error) -> bool {

#[cfg(target_os = "windows")]
fn is_permission_denied_error(err: &io::Error) -> bool {
err.kind() == io::ErrorKind::Other && err.raw_os_error() == Some(1314)
err.raw_os_error() == Some(1314)
}

impl Error {
Expand All @@ -75,7 +75,7 @@ impl Error {
}

if is_permission_denied_error(&error) {
return Error::PermissionDenied { name }
return Error::PermissionDenied { name };
}

Error::VarUnknownError { name, error }
Expand Down

0 comments on commit f757366

Please sign in to comment.