@@ -102,9 +102,6 @@ impl ImplMetadataExt {
102
102
#[ inline]
103
103
#[ allow( unused_comparisons) ] // NB: rust-lang/rust#115823 requires this here instead of on `st_dev` processing below
104
104
pub ( crate ) fn from_rustix ( stat : Stat ) -> Metadata {
105
- #[ cfg( not( target_os = "wasi" ) ) ]
106
- use rustix:: fs:: StatExt ;
107
-
108
105
Metadata {
109
106
file_type : ImplFileTypeExt :: from_raw_mode ( stat. st_mode as RawMode ) ,
110
107
len : u64:: try_from ( stat. st_size ) . unwrap ( ) ,
@@ -113,26 +110,15 @@ impl ImplMetadataExt {
113
110
#[ cfg( target_os = "wasi" ) ]
114
111
permissions : ImplPermissionsExt :: default ( ) ,
115
112
116
- #[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
117
- modified : system_time_from_rustix (
118
- stat. mtime ( ) . try_into ( ) . unwrap ( ) ,
119
- stat. st_mtime_nsec as _ ,
120
- ) ,
121
- #[ cfg( not( any( target_os = "netbsd" , target_os = "wasi" ) ) ) ]
122
- accessed : system_time_from_rustix (
123
- stat. atime ( ) . try_into ( ) . unwrap ( ) ,
124
- stat. st_atime_nsec as _ ,
125
- ) ,
126
-
127
- #[ cfg( target_os = "netbsd" ) ]
113
+ #[ cfg( not( target_os = "wasi" ) ) ]
128
114
modified : system_time_from_rustix (
129
115
stat. st_mtime . try_into ( ) . unwrap ( ) ,
130
- stat. st_mtimensec as _ ,
116
+ stat. st_mtime_nsec as _ ,
131
117
) ,
132
- #[ cfg( target_os = "netbsd" ) ]
118
+ #[ cfg( not ( target_os = "wasi" ) ) ]
133
119
accessed : system_time_from_rustix (
134
120
stat. st_atime . try_into ( ) . unwrap ( ) ,
135
- stat. st_atimensec as _ ,
121
+ stat. st_atime_nsec as _ ,
136
122
) ,
137
123
138
124
#[ cfg( target_os = "wasi" ) ]
@@ -143,6 +129,7 @@ impl ImplMetadataExt {
143
129
#[ cfg( any(
144
130
target_os = "freebsd" ,
145
131
target_os = "openbsd" ,
132
+ target_os = "netbsd" ,
146
133
target_os = "macos" ,
147
134
target_os = "ios" ,
148
135
target_os = "tvos" ,
@@ -154,12 +141,6 @@ impl ImplMetadataExt {
154
141
stat. st_birthtime_nsec as _ ,
155
142
) ,
156
143
157
- #[ cfg( target_os = "netbsd" ) ]
158
- created : system_time_from_rustix (
159
- stat. st_birthtime . try_into ( ) . unwrap ( ) ,
160
- stat. st_birthtimensec as _ ,
161
- ) ,
162
-
163
144
// `stat.st_ctime` is the latest status change; we want the creation.
164
145
#[ cfg( not( any(
165
146
target_os = "freebsd" ,
@@ -200,23 +181,17 @@ impl ImplMetadataExt {
200
181
rdev : u64:: try_from ( stat. st_rdev ) . unwrap ( ) ,
201
182
size : u64:: try_from ( stat. st_size ) . unwrap ( ) ,
202
183
#[ cfg( not( target_os = "wasi" ) ) ]
203
- atime : i64:: try_from ( stat. atime ( ) ) . unwrap ( ) ,
204
- #[ cfg( not( any ( target_os = "netbsd" , target_os = " wasi") ) ) ]
184
+ atime : i64:: try_from ( stat. st_atime ) . unwrap ( ) ,
185
+ #[ cfg( not( target_os = "wasi" ) ) ]
205
186
atime_nsec : stat. st_atime_nsec as _ ,
206
- #[ cfg( target_os = "netbsd" ) ]
207
- atime_nsec : stat. st_atimensec as _ ,
208
187
#[ cfg( not( target_os = "wasi" ) ) ]
209
- mtime : i64:: try_from ( stat. mtime ( ) ) . unwrap ( ) ,
210
- #[ cfg( not( any ( target_os = "netbsd" , target_os = " wasi") ) ) ]
188
+ mtime : i64:: try_from ( stat. st_mtime ) . unwrap ( ) ,
189
+ #[ cfg( not( target_os = "wasi" ) ) ]
211
190
mtime_nsec : stat. st_mtime_nsec as _ ,
212
- #[ cfg( target_os = "netbsd" ) ]
213
- mtime_nsec : stat. st_mtimensec as _ ,
214
191
#[ cfg( not( target_os = "wasi" ) ) ]
215
- ctime : i64:: try_from ( stat. ctime ( ) ) . unwrap ( ) ,
216
- #[ cfg( not( any ( target_os = "netbsd" , target_os = " wasi") ) ) ]
192
+ ctime : i64:: try_from ( stat. st_ctime ) . unwrap ( ) ,
193
+ #[ cfg( not( target_os = "wasi" ) ) ]
217
194
ctime_nsec : stat. st_ctime_nsec as _ ,
218
- #[ cfg( target_os = "netbsd" ) ]
219
- ctime_nsec : stat. st_ctimensec as _ ,
220
195
#[ cfg( not( target_os = "wasi" ) ) ]
221
196
blksize : u64:: try_from ( stat. st_blksize ) . unwrap ( ) ,
222
197
#[ cfg( not( target_os = "wasi" ) ) ]
0 commit comments