@@ -64,9 +64,10 @@ fn gather_test_suites(job_metrics: &HashMap<JobName, JobMetrics>) -> TestSuites
6464 Some ( ( name, variant) ) => ( name. to_string ( ) , variant. to_string ( ) ) ,
6565 None => ( test_name, "" . to_string ( ) ) ,
6666 } ;
67- let test_entry = suite_entry. tests . entry ( test_name. clone ( ) ) . or_insert_with ( || {
68- Test { name : test_name. clone ( ) , revisions : Default :: default ( ) }
69- } ) ;
67+ let test_entry = suite_entry
68+ . tests
69+ . entry ( test_name. clone ( ) )
70+ . or_insert_with ( || Test { revisions : Default :: default ( ) } ) ;
7071 let variant_entry = test_entry
7172 . revisions
7273 . entry ( variant_name)
@@ -91,16 +92,12 @@ fn gather_test_suites(job_metrics: &HashMap<JobName, JobMetrics>) -> TestSuites
9192 let mut suites = suites. into_iter ( ) . collect :: < Vec < _ > > ( ) ;
9293 suites. sort_by ( |a, b| a. 0 . cmp ( & b. 0 ) ) ;
9394
94- let mut target_suites = vec ! [ ] ;
95- for ( suite_name, suite) in suites {
96- let suite = TestSuite {
97- name : suite_name. clone ( ) ,
98- group : build_test_group ( & suite_name, suite. tests ) ,
99- } ;
100- target_suites. push ( suite) ;
101- }
95+ let suites = suites
96+ . into_iter ( )
97+ . map ( |( suite_name, suite) | TestSuite { group : build_test_group ( & suite_name, suite. tests ) } )
98+ . collect ( ) ;
10299
103- TestSuites { suites : target_suites }
100+ TestSuites { suites }
104101}
105102
106103/// Recursively expand a test group based on filesystem hierarchy.
@@ -115,7 +112,7 @@ fn build_test_group<'a>(name: &str, tests: BTreeMap<String, Test<'a>>) -> TestGr
115112
116113 if components. peek ( ) . is_none ( ) {
117114 // This is a root test
118- root_tests. push ( test) ;
115+ root_tests. push ( ( name , test) ) ;
119116 } else {
120117 // This is a test in a nested directory
121118 let subdir_tests =
@@ -148,7 +145,6 @@ fn normalize_test_name(name: &str, suite_name: &str) -> String {
148145 name. trim_start_matches ( "/" ) . to_string ( )
149146}
150147
151- #[ derive( serde:: Serialize ) ]
152148struct TestSuites < ' a > {
153149 suites : Vec < TestSuite < ' a > > ,
154150}
@@ -159,21 +155,16 @@ impl<'a> TestSuites<'a> {
159155 }
160156}
161157
162- #[ derive( serde:: Serialize ) ]
163158struct TestSuite < ' a > {
164- name : String ,
165159 group : TestGroup < ' a > ,
166160}
167161
168- #[ derive( Debug , serde:: Serialize ) ]
169162struct TestResults < ' a > {
170163 passed : Vec < TestMetadata < ' a > > ,
171164 ignored : Vec < TestMetadata < ' a > > ,
172165}
173166
174- #[ derive( Debug , serde:: Serialize ) ]
175167struct Test < ' a > {
176- name : String ,
177168 revisions : BTreeMap < String , TestResults < ' a > > ,
178169}
179170
@@ -189,7 +180,8 @@ impl<'a> Test<'a> {
189180 }
190181}
191182
192- #[ derive( Clone , Copy , Debug , serde:: Serialize ) ]
183+ #[ derive( Clone , Copy ) ]
184+ #[ allow( dead_code) ]
193185struct TestMetadata < ' a > {
194186 job : & ' a str ,
195187 stage : u32 ,
@@ -198,13 +190,13 @@ struct TestMetadata<'a> {
198190
199191// We have to use a template for the TestGroup instead of a macro, because
200192// macros cannot be recursive in askama at the moment.
201- #[ derive( Template , serde :: Serialize ) ]
193+ #[ derive( Template ) ]
202194#[ template( path = "test_group.askama" ) ]
203195/// Represents a group of tests
204196struct TestGroup < ' a > {
205197 name : String ,
206198 /// Tests located directly in this directory
207- root_tests : Vec < Test < ' a > > ,
199+ root_tests : Vec < ( String , Test < ' a > ) > ,
208200 /// Nested directories with additional tests
209201 groups : Vec < ( String , TestGroup < ' a > ) > ,
210202}
0 commit comments