Skip to content

Commit

Permalink
Fix another warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed Mar 29, 2024
1 parent dc96cc8 commit 9cea8fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cap-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ io-lifetimes = { version = "2.0.0", default-features = false }
cap-tempfile = { path = "../cap-tempfile" }

[target.'cfg(not(windows))'.dependencies]
rustix = { version = "0.38.0", features = ["fs", "process", "procfs", "termios", "time"] }
rustix = { version = "0.38.32", features = ["fs", "process", "procfs", "termios", "time"] }

[target.'cfg(windows)'.dependencies]
winx = "0.36.0"
Expand Down
12 changes: 7 additions & 5 deletions cap-primitives/src/rustix/fs/metadata_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ impl ImplMetadataExt {
#[inline]
#[allow(unused_comparisons)] // NB: rust-lang/rust#115823 requires this here instead of on `st_dev` processing below
pub(crate) fn from_rustix(stat: Stat) -> Metadata {
use rustix::fs::StatExt;

Metadata {
file_type: ImplFileTypeExt::from_raw_mode(stat.st_mode as RawMode),
len: u64::try_from(stat.st_size).unwrap(),
Expand All @@ -112,12 +114,12 @@ impl ImplMetadataExt {

#[cfg(not(any(target_os = "netbsd", target_os = "wasi")))]
modified: system_time_from_rustix(
stat.st_mtime.try_into().unwrap(),
stat.mtime().try_into().unwrap(),
stat.st_mtime_nsec as _,
),
#[cfg(not(any(target_os = "netbsd", target_os = "wasi")))]
accessed: system_time_from_rustix(
stat.st_atime.try_into().unwrap(),
stat.atime().try_into().unwrap(),
stat.st_atime_nsec as _,
),

Expand Down Expand Up @@ -191,19 +193,19 @@ impl ImplMetadataExt {
rdev: u64::try_from(stat.st_rdev).unwrap(),
size: u64::try_from(stat.st_size).unwrap(),
#[cfg(not(target_os = "wasi"))]
atime: i64::try_from(stat.st_atime).unwrap(),
atime: i64::try_from(stat.atime()).unwrap(),
#[cfg(not(any(target_os = "netbsd", target_os = "wasi")))]
atime_nsec: stat.st_atime_nsec as _,
#[cfg(target_os = "netbsd")]
atime_nsec: stat.st_atimensec as _,
#[cfg(not(target_os = "wasi"))]
mtime: i64::try_from(stat.st_mtime).unwrap(),
mtime: i64::try_from(stat.mtime()).unwrap(),
#[cfg(not(any(target_os = "netbsd", target_os = "wasi")))]
mtime_nsec: stat.st_mtime_nsec as _,
#[cfg(target_os = "netbsd")]
mtime_nsec: stat.st_mtimensec as _,
#[cfg(not(target_os = "wasi"))]
ctime: i64::try_from(stat.st_ctime).unwrap(),
ctime: i64::try_from(stat.ctime()).unwrap(),
#[cfg(not(any(target_os = "netbsd", target_os = "wasi")))]
ctime_nsec: stat.st_ctime_nsec as _,
#[cfg(target_os = "netbsd")]
Expand Down

0 comments on commit 9cea8fc

Please sign in to comment.