Skip to content

Commit

Permalink
Fix E0308 to compile on apple hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
choznerol authored and d-e-s-o committed Oct 7, 2023
1 parent 980fce7 commit 6ddf760
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/cap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ use tokio::runtime::Handle;
/// Change the provided `Permissions` by making it read-only.
#[cfg(unix)]
fn read_only(mut permissions: Permissions) -> Permissions {
// Remove user write permissions.
let () = permissions.set_mode(permissions.mode() & !S_IWUSR);
// Remove user write permissions. Note that `S_IWUSR` is `u16` on some
// platforms.
#[allow(trivial_numeric_casts, clippy::unnecessary_cast)]
let () = permissions.set_mode(permissions.mode() & !S_IWUSR as u32);
permissions
}

Expand All @@ -47,7 +49,8 @@ fn read_only(mut permissions: Permissions) -> Permissions {
#[cfg(unix)]
fn writeable(mut permissions: Permissions) -> Permissions {
// Set user write permissions.
let () = permissions.set_mode(permissions.mode() | S_IWUSR);
#[allow(trivial_numeric_casts, clippy::unnecessary_cast)]
let () = permissions.set_mode(permissions.mode() | S_IWUSR as u32);
permissions
}

Expand Down

0 comments on commit 6ddf760

Please sign in to comment.