@@ -154,16 +154,18 @@ struct ExecReportSpec {
154154 report_globs : Vec < String > ,
155155}
156156
157- impl ExecReportSpec {
158- fn paths ( self ) -> Result < Vec < PathBuf > , AlreadyReportedToCommandline > {
159- let Self {
160- report_paths,
161- report_globs,
162- } = self ;
157+ struct FileSpec {
158+ paths : Vec < PathBuf > ,
159+ globs : Vec < String > ,
160+ }
163161
164- let report_globs = {
162+ impl FileSpec {
163+ fn into_paths ( self , what : impl Display ) -> Result < Vec < PathBuf > , AlreadyReportedToCommandline > {
164+ let Self { paths, globs } = self ;
165+
166+ let globs = {
165167 let mut found_glob_parse_err = false ;
166- let globs = report_globs
168+ let globs = globs
167169 . into_iter ( )
168170 . filter_map ( |glob| match Glob :: diagnosed ( & glob) {
169171 Ok ( ( glob, _diagnostics) ) => Some ( glob. into_owned ( ) . partition ( ) ) ,
@@ -186,16 +188,16 @@ impl ExecReportSpec {
186188 . collect :: < Vec < _ > > ( ) ;
187189
188190 if found_glob_parse_err {
189- log:: error!( "failed to parse one or more WPT report globs ; bailing" ) ;
191+ log:: error!( "failed to parse one or more globs for {what} ; bailing" ) ;
190192 return Err ( AlreadyReportedToCommandline ) ;
191193 }
192194
193195 globs
194196 } ;
195197
196- let report_paths_from_glob = {
198+ let paths_from_globs = {
197199 let mut found_glob_walk_err = false ;
198- let files = report_globs
200+ let files = globs
199201 . iter ( )
200202 . flat_map ( |( base_path, glob) | {
201203 glob. walk ( base_path)
@@ -205,12 +207,12 @@ impl ExecReportSpec {
205207 found_glob_walk_err = true ;
206208 let ctx_msg = if let Some ( path) = e. path ( ) {
207209 format ! (
208- "failed to enumerate files for glob `{}` at path {}" ,
210+ "failed to enumerate {what} from glob `{}` at path {}" ,
209211 glob,
210212 path. display( )
211213 )
212214 } else {
213- format ! ( "failed to enumerate files for glob `{glob}`" )
215+ format ! ( "failed to enumerate {what} from glob `{glob}`" )
214216 } ;
215217 let e = Report :: msg ( e) . wrap_err ( ctx_msg) ;
216218 eprintln ! ( "{e:?}" ) ;
@@ -222,44 +224,68 @@ impl ExecReportSpec {
222224 . collect :: < Vec < _ > > ( ) ;
223225
224226 if found_glob_walk_err {
225- log:: error!( concat!(
226- "failed to enumerate files with WPT report globs, " ,
227- "see above for more details"
228- ) ) ;
227+ log:: error!(
228+ concat!(
229+ "failed to enumerate {} from globs, " ,
230+ "see above for more details"
231+ ) ,
232+ what
233+ ) ;
229234 return Err ( AlreadyReportedToCommandline ) ;
230235 }
231236
232237 files
233238 } ;
234239
235- if report_paths_from_glob. is_empty ( ) && !report_globs. is_empty ( ) {
236- if report_paths. is_empty ( ) {
237- log:: error!( concat!(
238- "reports were specified exclusively via glob search, " ,
239- "but none were found; bailing"
240- ) ) ;
240+ if paths_from_globs. is_empty ( ) && !globs. is_empty ( ) {
241+ if paths. is_empty ( ) {
242+ log:: error!(
243+ concat!(
244+ "{} were specified exclusively via glob search, " ,
245+ "but none were found; bailing"
246+ ) ,
247+ what
248+ ) ;
241249 return Err ( AlreadyReportedToCommandline ) ;
242250 } else {
243- log:: warn!( concat!(
244- "reports were specified via path and glob search, " ,
245- "but none were found via glob; " ,
246- "continuing with report paths"
247- ) )
251+ log:: warn!(
252+ concat!(
253+ "{} were specified via path and glob search, " ,
254+ "but none were found via glob; " ,
255+ "continuing with direct paths"
256+ ) ,
257+ what
258+ )
248259 }
249260 }
250261
251- let exec_report_paths = report_paths
262+ let exec_report_paths = paths
252263 . into_iter ( )
253- . chain ( report_paths_from_glob )
264+ . chain ( paths_from_globs )
254265 . collect :: < Vec < _ > > ( ) ;
255266
256- log:: trace!( "working with the following WPT report files : {exec_report_paths:#?}" ) ;
257- log:: info!( "working with {} WPT report files " , exec_report_paths. len( ) ) ;
267+ log:: trace!( "working with the following {what} : {exec_report_paths:#?}" ) ;
268+ log:: info!( "working with {} {what} " , exec_report_paths. len( ) ) ;
258269
259270 Ok ( exec_report_paths)
260271 }
261272}
262273
274+ impl ExecReportSpec {
275+ fn paths ( self ) -> Result < Vec < PathBuf > , AlreadyReportedToCommandline > {
276+ let Self {
277+ report_paths,
278+ report_globs,
279+ } = self ;
280+
281+ FileSpec {
282+ paths : report_paths,
283+ globs : report_globs,
284+ }
285+ . into_paths ( "WPT report(s)" )
286+ }
287+ }
288+
263289#[ derive( Clone , Copy , Debug , ValueEnum ) ]
264290enum UpdateExpectedPreset {
265291 /// alias: `new-fx`, `new-build`
0 commit comments