@@ -628,23 +628,23 @@ impl ByteSliceExt for [u8] {
628628}
629629
630630impl LineInfo {
631- fn parse ( s : impl AsRef < OsStr > , cached_lineformat : & mut Option < LineFormat > ) -> Option < Self > {
631+ fn parse ( s : impl AsRef < OsStr > , cached_line_format : & mut Option < LineFormat > ) -> Option < Self > {
632632 let line_bytes = os_str_as_bytes ( s. as_ref ( ) ) . ok ( ) ?;
633633
634634 if let Some ( info) = LineFormat :: parse_algo_based ( line_bytes) {
635635 return Some ( info) ;
636636 }
637- if let Some ( cached_format) = cached_lineformat {
637+ if let Some ( cached_format) = cached_line_format {
638638 match cached_format {
639639 LineFormat :: Untagged => LineFormat :: parse_untagged ( line_bytes) ,
640640 LineFormat :: SingleSpace => LineFormat :: parse_single_space ( line_bytes) ,
641641 _ => unreachable ! ( "we never catch the algo based format" ) ,
642642 }
643643 } else if let Some ( info) = LineFormat :: parse_untagged ( line_bytes) {
644- * cached_lineformat = Some ( LineFormat :: Untagged ) ;
644+ * cached_line_format = Some ( LineFormat :: Untagged ) ;
645645 Some ( info)
646646 } else if let Some ( info) = LineFormat :: parse_single_space ( line_bytes) {
647- * cached_lineformat = Some ( LineFormat :: SingleSpace ) ;
647+ * cached_line_format = Some ( LineFormat :: SingleSpace ) ;
648648 Some ( info)
649649 } else {
650650 None
@@ -923,7 +923,7 @@ fn process_checksum_line(
923923 cli_algo_name : Option < & str > ,
924924 cli_algo_length : Option < usize > ,
925925 opts : ChecksumOptions ,
926- cached_lineformat : & mut Option < LineFormat > ,
926+ cached_line_format : & mut Option < LineFormat > ,
927927 last_algo : & mut Option < String > ,
928928) -> Result < ( ) , LineCheckError > {
929929 let line_bytes = os_str_as_bytes ( line) ?;
@@ -935,7 +935,7 @@ fn process_checksum_line(
935935
936936 // Use `LineInfo` to extract the data of a line.
937937 // Then, depending on its format, apply a different pre-treatment.
938- let Some ( line_info) = LineInfo :: parse ( line, cached_lineformat ) else {
938+ let Some ( line_info) = LineInfo :: parse ( line, cached_line_format ) else {
939939 return Err ( LineCheckError :: ImproperlyFormatted ) ;
940940 } ;
941941
@@ -978,9 +978,9 @@ fn process_checksum_file(
978978 let reader = BufReader :: new ( file) ;
979979 let lines = read_os_string_lines ( reader) . collect :: < Vec < _ > > ( ) ;
980980
981- // cached_lineformat is used to ensure that several non algo-based checksum line
981+ // cached_line_format is used to ensure that several non algo-based checksum line
982982 // will use the same parser.
983- let mut cached_lineformat = None ;
983+ let mut cached_line_format = None ;
984984 // last_algo caches the algorithm used in the last line to print a warning
985985 // message for the current line if improperly formatted.
986986 // Behavior tested in gnu_cksum_c::test_warn
@@ -993,7 +993,7 @@ fn process_checksum_file(
993993 cli_algo_name,
994994 cli_algo_length,
995995 opts,
996- & mut cached_lineformat ,
996+ & mut cached_line_format ,
997997 & mut last_algo,
998998 ) ;
999999
@@ -1450,69 +1450,69 @@ mod tests {
14501450
14511451 #[ test]
14521452 fn test_line_info ( ) {
1453- let mut cached_lineformat = None ;
1453+ let mut cached_line_format = None ;
14541454
14551455 // Test algo-based parser
14561456 let line_algo_based =
14571457 OsString :: from ( "MD5 (example.txt) = d41d8cd98f00b204e9800998ecf8427e" ) ;
1458- let line_info = LineInfo :: parse ( & line_algo_based, & mut cached_lineformat ) . unwrap ( ) ;
1458+ let line_info = LineInfo :: parse ( & line_algo_based, & mut cached_line_format ) . unwrap ( ) ;
14591459 assert_eq ! ( line_info. algo_name. as_deref( ) , Some ( "MD5" ) ) ;
14601460 assert ! ( line_info. algo_bit_len. is_none( ) ) ;
14611461 assert_eq ! ( line_info. filename, b"example.txt" ) ;
14621462 assert_eq ! ( line_info. checksum, "d41d8cd98f00b204e9800998ecf8427e" ) ;
14631463 assert_eq ! ( line_info. format, LineFormat :: AlgoBased ) ;
1464- assert ! ( cached_lineformat . is_none( ) ) ;
1464+ assert ! ( cached_line_format . is_none( ) ) ;
14651465
14661466 // Test double-space parser
14671467 let line_double_space = OsString :: from ( "d41d8cd98f00b204e9800998ecf8427e example.txt" ) ;
1468- let line_info = LineInfo :: parse ( & line_double_space, & mut cached_lineformat ) . unwrap ( ) ;
1468+ let line_info = LineInfo :: parse ( & line_double_space, & mut cached_line_format ) . unwrap ( ) ;
14691469 assert ! ( line_info. algo_name. is_none( ) ) ;
14701470 assert ! ( line_info. algo_bit_len. is_none( ) ) ;
14711471 assert_eq ! ( line_info. filename, b"example.txt" ) ;
14721472 assert_eq ! ( line_info. checksum, "d41d8cd98f00b204e9800998ecf8427e" ) ;
14731473 assert_eq ! ( line_info. format, LineFormat :: Untagged ) ;
1474- assert ! ( cached_lineformat . is_some( ) ) ;
1474+ assert ! ( cached_line_format . is_some( ) ) ;
14751475
1476- cached_lineformat = None ;
1476+ cached_line_format = None ;
14771477
14781478 // Test single-space parser
14791479 let line_single_space = OsString :: from ( "d41d8cd98f00b204e9800998ecf8427e example.txt" ) ;
1480- let line_info = LineInfo :: parse ( & line_single_space, & mut cached_lineformat ) . unwrap ( ) ;
1480+ let line_info = LineInfo :: parse ( & line_single_space, & mut cached_line_format ) . unwrap ( ) ;
14811481 assert ! ( line_info. algo_name. is_none( ) ) ;
14821482 assert ! ( line_info. algo_bit_len. is_none( ) ) ;
14831483 assert_eq ! ( line_info. filename, b"example.txt" ) ;
14841484 assert_eq ! ( line_info. checksum, "d41d8cd98f00b204e9800998ecf8427e" ) ;
14851485 assert_eq ! ( line_info. format, LineFormat :: SingleSpace ) ;
1486- assert ! ( cached_lineformat . is_some( ) ) ;
1486+ assert ! ( cached_line_format . is_some( ) ) ;
14871487
1488- cached_lineformat = None ;
1488+ cached_line_format = None ;
14891489
14901490 // Test invalid checksum line
14911491 let line_invalid = OsString :: from ( "invalid checksum line" ) ;
1492- assert ! ( LineInfo :: parse( & line_invalid, & mut cached_lineformat ) . is_none( ) ) ;
1493- assert ! ( cached_lineformat . is_none( ) ) ;
1492+ assert ! ( LineInfo :: parse( & line_invalid, & mut cached_line_format ) . is_none( ) ) ;
1493+ assert ! ( cached_line_format . is_none( ) ) ;
14941494
14951495 // Test leading space before checksum line
14961496 let line_algo_based_leading_space =
14971497 OsString :: from ( " MD5 (example.txt) = d41d8cd98f00b204e9800998ecf8427e" ) ;
14981498 let line_info =
1499- LineInfo :: parse ( & line_algo_based_leading_space, & mut cached_lineformat ) . unwrap ( ) ;
1499+ LineInfo :: parse ( & line_algo_based_leading_space, & mut cached_line_format ) . unwrap ( ) ;
15001500 assert_eq ! ( line_info. format, LineFormat :: AlgoBased ) ;
1501- assert ! ( cached_lineformat . is_none( ) ) ;
1501+ assert ! ( cached_line_format . is_none( ) ) ;
15021502
15031503 // Test trailing space after checksum line (should fail)
15041504 let line_algo_based_leading_space =
15051505 OsString :: from ( "MD5 (example.txt) = d41d8cd98f00b204e9800998ecf8427e " ) ;
1506- let res = LineInfo :: parse ( & line_algo_based_leading_space, & mut cached_lineformat ) ;
1506+ let res = LineInfo :: parse ( & line_algo_based_leading_space, & mut cached_line_format ) ;
15071507 assert ! ( res. is_none( ) ) ;
1508- assert ! ( cached_lineformat . is_none( ) ) ;
1508+ assert ! ( cached_line_format . is_none( ) ) ;
15091509 }
15101510
15111511 #[ test]
15121512 fn test_get_expected_digest ( ) {
15131513 let line = OsString :: from ( "SHA256 (empty) = 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=" ) ;
1514- let mut cached_lineformat = None ;
1515- let line_info = LineInfo :: parse ( & line, & mut cached_lineformat ) . unwrap ( ) ;
1514+ let mut cached_line_format = None ;
1515+ let line_info = LineInfo :: parse ( & line, & mut cached_line_format ) . unwrap ( ) ;
15161516
15171517 let result = get_expected_digest_as_hex_string ( & line_info, None ) ;
15181518
@@ -1526,8 +1526,8 @@ mod tests {
15261526 fn test_get_expected_checksum_invalid ( ) {
15271527 // The line misses a '=' at the end to be valid base64
15281528 let line = OsString :: from ( "SHA256 (empty) = 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU" ) ;
1529- let mut cached_lineformat = None ;
1530- let line_info = LineInfo :: parse ( & line, & mut cached_lineformat ) . unwrap ( ) ;
1529+ let mut cached_line_format = None ;
1530+ let line_info = LineInfo :: parse ( & line, & mut cached_line_format ) . unwrap ( ) ;
15311531
15321532 let result = get_expected_digest_as_hex_string ( & line_info, None ) ;
15331533
0 commit comments