@@ -773,9 +773,15 @@ enum LocalFingerprint {
773773/// See [`FsStatus::StaleItem`].
774774#[ derive( Clone , Debug ) ]
775775pub enum StaleItem {
776- MissingFile ( PathBuf ) ,
777- UnableToReadFile ( PathBuf ) ,
778- FailedToReadMetadata ( PathBuf ) ,
776+ MissingFile {
777+ path : PathBuf ,
778+ } ,
779+ UnableToReadFile {
780+ path : PathBuf ,
781+ } ,
782+ FailedToReadMetadata {
783+ path : PathBuf ,
784+ } ,
779785 FileSizeChanged {
780786 path : PathBuf ,
781787 old_size : u64 ,
@@ -792,7 +798,9 @@ pub enum StaleItem {
792798 stored_checksum : Checksum ,
793799 new_checksum : Checksum ,
794800 } ,
795- MissingChecksum ( PathBuf ) ,
801+ MissingChecksum {
802+ path : PathBuf ,
803+ } ,
796804 ChangedEnv {
797805 var : String ,
798806 previous : Option < String > ,
@@ -854,7 +862,7 @@ impl LocalFingerprint {
854862 LocalFingerprint :: CheckDepInfo { dep_info, checksum } => {
855863 let dep_info = build_root. join ( dep_info) ;
856864 let Some ( info) = parse_dep_info ( pkg_root, build_root, & dep_info) ? else {
857- return Ok ( Some ( StaleItem :: MissingFile ( dep_info) ) ) ;
865+ return Ok ( Some ( StaleItem :: MissingFile { path : dep_info } ) ) ;
858866 } ;
859867 for ( key, previous) in info. env . iter ( ) {
860868 if let Some ( value) = pkg. manifest ( ) . metadata ( ) . env_var ( key. as_str ( ) ) {
@@ -1170,7 +1178,9 @@ impl Fingerprint {
11701178 let Ok ( mtime) = paths:: mtime ( output) else {
11711179 // This path failed to report its `mtime`. It probably doesn't
11721180 // exists, so leave ourselves as stale and bail out.
1173- let item = StaleItem :: FailedToReadMetadata ( output. clone ( ) ) ;
1181+ let item = StaleItem :: FailedToReadMetadata {
1182+ path : output. clone ( ) ,
1183+ } ;
11741184 self . fs_status = FsStatus :: StaleItem ( item) ;
11751185 return Ok ( ( ) ) ;
11761186 } ;
@@ -1366,13 +1376,13 @@ impl StaleItem {
13661376 /// that.
13671377 fn log ( & self ) {
13681378 match self {
1369- StaleItem :: MissingFile ( path) => {
1379+ StaleItem :: MissingFile { path } => {
13701380 info ! ( "stale: missing {:?}" , path) ;
13711381 }
1372- StaleItem :: UnableToReadFile ( path) => {
1382+ StaleItem :: UnableToReadFile { path } => {
13731383 info ! ( "stale: unable to read {:?}" , path) ;
13741384 }
1375- StaleItem :: FailedToReadMetadata ( path) => {
1385+ StaleItem :: FailedToReadMetadata { path } => {
13761386 info ! ( "stale: couldn't read metadata {:?}" , path) ;
13771387 }
13781388 StaleItem :: ChangedFile {
@@ -1403,7 +1413,7 @@ impl StaleItem {
14031413 info ! ( "prior checksum {stored_checksum}" ) ;
14041414 info ! ( " new checksum {new_checksum}" ) ;
14051415 }
1406- StaleItem :: MissingChecksum ( path) => {
1416+ StaleItem :: MissingChecksum { path } => {
14071417 info ! ( "stale: no prior checksum {:?}" , path) ;
14081418 }
14091419 StaleItem :: ChangedEnv {
@@ -1958,8 +1968,13 @@ where
19581968 I : IntoIterator < Item = ( P , Option < ( u64 , Checksum ) > ) > ,
19591969 P : AsRef < Path > ,
19601970{
1961- let Ok ( reference_mtime) = paths:: mtime ( reference) else {
1962- return Some ( StaleItem :: MissingFile ( reference. to_path_buf ( ) ) ) ;
1971+ let reference_mtime = match paths:: mtime ( reference) {
1972+ Ok ( mtime) => mtime,
1973+ Err ( ..) => {
1974+ return Some ( StaleItem :: MissingFile {
1975+ path : reference. to_path_buf ( ) ,
1976+ } ) ;
1977+ }
19631978 } ;
19641979
19651980 let skippable_dirs = if let Ok ( cargo_home) = home:: cargo_home ( ) {
@@ -1985,15 +2000,19 @@ where
19852000 }
19862001 if use_checksums {
19872002 let Some ( ( file_len, prior_checksum) ) = prior_checksum else {
1988- return Some ( StaleItem :: MissingChecksum ( path. to_path_buf ( ) ) ) ;
2003+ return Some ( StaleItem :: MissingChecksum {
2004+ path : path. to_path_buf ( ) ,
2005+ } ) ;
19892006 } ;
19902007 let path_buf = path. to_path_buf ( ) ;
19912008
19922009 let path_checksum = match checksum_cache. entry ( path_buf) {
19932010 Entry :: Occupied ( o) => * o. get ( ) ,
19942011 Entry :: Vacant ( v) => {
19952012 let Ok ( current_file_len) = fs:: metadata ( & path) . map ( |m| m. len ( ) ) else {
1996- return Some ( StaleItem :: FailedToReadMetadata ( path. to_path_buf ( ) ) ) ;
2013+ return Some ( StaleItem :: FailedToReadMetadata {
2014+ path : path. to_path_buf ( ) ,
2015+ } ) ;
19972016 } ;
19982017 if current_file_len != file_len {
19992018 return Some ( StaleItem :: FileSizeChanged {
@@ -2003,10 +2022,14 @@ where
20032022 } ) ;
20042023 }
20052024 let Ok ( file) = File :: open ( path) else {
2006- return Some ( StaleItem :: MissingFile ( path. to_path_buf ( ) ) ) ;
2025+ return Some ( StaleItem :: MissingFile {
2026+ path : path. to_path_buf ( ) ,
2027+ } ) ;
20072028 } ;
20082029 let Ok ( checksum) = Checksum :: compute ( prior_checksum. algo ( ) , file) else {
2009- return Some ( StaleItem :: UnableToReadFile ( path. to_path_buf ( ) ) ) ;
2030+ return Some ( StaleItem :: UnableToReadFile {
2031+ path : path. to_path_buf ( ) ,
2032+ } ) ;
20102033 } ;
20112034 * v. insert ( checksum)
20122035 }
@@ -2024,7 +2047,9 @@ where
20242047 Entry :: Occupied ( o) => * o. get ( ) ,
20252048 Entry :: Vacant ( v) => {
20262049 let Ok ( mtime) = paths:: mtime_recursive ( path) else {
2027- return Some ( StaleItem :: MissingFile ( path. to_path_buf ( ) ) ) ;
2050+ return Some ( StaleItem :: MissingFile {
2051+ path : path. to_path_buf ( ) ,
2052+ } ) ;
20282053 } ;
20292054 * v. insert ( mtime)
20302055 }
0 commit comments