@@ -538,8 +538,8 @@ where
538
538
continue ;
539
539
}
540
540
541
- let timestamp = extract_timestamp_from_session_dir ( & directory_name) . unwrap_or_else ( |_ | {
542
- bug ! ( "unexpected incr-comp session dir: {}" , session_dir. display( ) )
541
+ let timestamp = extract_timestamp_from_session_dir ( & directory_name) . unwrap_or_else ( |e | {
542
+ bug ! ( "unexpected incr-comp session dir: {}: {} " , session_dir. display( ) , e )
543
543
} ) ;
544
544
545
545
if timestamp > best_candidate. 0 {
@@ -562,14 +562,14 @@ fn is_session_directory_lock_file(file_name: &str) -> bool {
562
562
file_name. starts_with ( "s-" ) && file_name. ends_with ( LOCK_FILE_EXT )
563
563
}
564
564
565
- fn extract_timestamp_from_session_dir ( directory_name : & str ) -> Result < SystemTime , ( ) > {
565
+ fn extract_timestamp_from_session_dir ( directory_name : & str ) -> Result < SystemTime , & ' static str > {
566
566
if !is_session_directory ( directory_name) {
567
- return Err ( ( ) ) ;
567
+ return Err ( "not a directory" ) ;
568
568
}
569
569
570
570
let dash_indices: Vec < _ > = directory_name. match_indices ( '-' ) . map ( |( idx, _) | idx) . collect ( ) ;
571
571
if dash_indices. len ( ) != 3 {
572
- return Err ( ( ) ) ;
572
+ return Err ( "not three dashes in name" ) ;
573
573
}
574
574
575
575
string_to_timestamp ( & directory_name[ dash_indices[ 0 ] + 1 ..dash_indices[ 1 ] ] )
@@ -581,11 +581,11 @@ fn timestamp_to_string(timestamp: SystemTime) -> String {
581
581
base_n:: encode ( micros as u128 , INT_ENCODE_BASE )
582
582
}
583
583
584
- fn string_to_timestamp ( s : & str ) -> Result < SystemTime , ( ) > {
584
+ fn string_to_timestamp ( s : & str ) -> Result < SystemTime , & ' static str > {
585
585
let micros_since_unix_epoch = u64:: from_str_radix ( s, INT_ENCODE_BASE as u32 ) ;
586
586
587
587
if micros_since_unix_epoch. is_err ( ) {
588
- return Err ( ( ) ) ;
588
+ return Err ( "timestamp not an int" ) ;
589
589
}
590
590
591
591
let micros_since_unix_epoch = micros_since_unix_epoch. unwrap ( ) ;
0 commit comments