@@ -37,8 +37,8 @@ use walkdir::WalkDir;
37
37
38
38
use self :: header:: { EarlyProps , make_test_description} ;
39
39
use crate :: common:: {
40
- Config , Mode , PassMode , TestPaths , UI_EXTENSIONS , expected_output_path, output_base_dir ,
41
- output_relative_path,
40
+ CompareMode , Config , Mode , PassMode , TestPaths , UI_EXTENSIONS , expected_output_path,
41
+ output_base_dir , output_relative_path,
42
42
} ;
43
43
use crate :: header:: HeadersCache ;
44
44
use crate :: util:: logv;
@@ -273,6 +273,15 @@ pub fn parse_config(args: Vec<String>) -> Config {
273
273
} else {
274
274
matches. free . clone ( )
275
275
} ;
276
+ let compare_mode = matches. opt_str ( "compare-mode" ) . map ( |s| {
277
+ s. parse ( ) . unwrap_or_else ( |_| {
278
+ let variants: Vec < _ > = CompareMode :: STR_VARIANTS . iter ( ) . copied ( ) . collect ( ) ;
279
+ panic ! (
280
+ "`{s}` is not a valid value for `--compare-mode`, it should be one of: {}" ,
281
+ variants. join( ", " )
282
+ ) ;
283
+ } )
284
+ } ) ;
276
285
Config {
277
286
bless : matches. opt_present ( "bless" ) ,
278
287
compile_lib_path : make_absolute ( opt_path ( matches, "compile-lib-path" ) ) ,
@@ -342,9 +351,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
342
351
only_modified : matches. opt_present ( "only-modified" ) ,
343
352
color,
344
353
remote_test_client : matches. opt_str ( "remote-test-client" ) . map ( PathBuf :: from) ,
345
- compare_mode : matches
346
- . opt_str ( "compare-mode" )
347
- . map ( |s| s. parse ( ) . expect ( "invalid --compare-mode provided" ) ) ,
354
+ compare_mode,
348
355
rustfix_coverage : matches. opt_present ( "rustfix-coverage" ) ,
349
356
has_html_tidy,
350
357
has_enzyme,
0 commit comments