@@ -84,7 +84,9 @@ pub fn check(tests_path: impl AsRef<Path>, bad: &mut bool) {
8484 }
8585 } ) ;
8686
87- let Some ( ( test_name, _) ) = test. to_str ( ) . map ( |s| s. split_once ( '.' ) ) . flatten ( ) else {
87+ let Some ( ( test_name, _) ) =
88+ test. file_name ( ) . map ( OsStr :: to_str) . flatten ( ) . map ( |n| n. split_once ( '.' ) ) . flatten ( )
89+ else {
8890 continue ;
8991 } ;
9092
@@ -98,14 +100,20 @@ pub fn check(tests_path: impl AsRef<Path>, bad: &mut bool) {
98100 for sibling in files_under_inspection. iter ( ) . filter ( |f| {
99101 f. extension ( ) . map ( OsStr :: to_str) . flatten ( ) . is_some_and ( |ext| EXTENSIONS . contains ( & ext) )
100102 } ) {
101- let filename_components = sibling. to_str ( ) . unwrap ( ) . split ( '.' ) . collect :: < Vec < _ > > ( ) ;
102- let file_prefix = filename_components[ 0 ] ;
103+ let Some ( filename) = sibling. file_name ( ) . map ( OsStr :: to_str) . flatten ( ) else {
104+ continue ;
105+ } ;
106+
107+ let filename_components = filename. split ( '.' ) . collect :: < Vec < _ > > ( ) ;
108+ let [ file_prefix, ..] = & filename_components[ ..] else {
109+ continue ;
110+ } ;
103111
104- let Some ( ( test_path, expected_revisions) ) = test_info. get ( file_prefix) else {
112+ let Some ( ( test_path, expected_revisions) ) = test_info. get ( * file_prefix) else {
105113 continue ;
106114 } ;
107115
108- match filename_components[ ..] {
116+ match & filename_components[ ..] {
109117 // Cannot have a revision component, skip.
110118 [ ] | [ _] => return ,
111119 [ _, _] if !expected_revisions. is_empty ( ) => {
@@ -120,9 +128,9 @@ pub fn check(tests_path: impl AsRef<Path>, bad: &mut bool) {
120128 [ _, _] => return ,
121129 [ _, found_revision, .., extension] => {
122130 if !IGNORES . contains ( & found_revision)
123- && !expected_revisions. contains ( found_revision)
131+ && !expected_revisions. contains ( * found_revision)
124132 // This is from `//@ stderr-per-bitwidth`
125- && !( extension == "stderr" && [ "32bit" , "64bit" ] . contains ( & found_revision) )
133+ && !( * extension == "stderr" && [ "32bit" , "64bit" ] . contains ( & found_revision) )
126134 {
127135 // Found some unexpected revision-esque component that is not a known
128136 // compare-mode or expected revision.
0 commit comments