@@ -37,8 +37,8 @@ use walkdir::WalkDir;
3737
3838use self :: header:: { EarlyProps , make_test_description} ;
3939use 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,
4242} ;
4343use crate :: header:: HeadersCache ;
4444use crate :: util:: logv;
@@ -273,6 +273,15 @@ pub fn parse_config(args: Vec<String>) -> Config {
273273 } else {
274274 matches. free . clone ( )
275275 } ;
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+ } ) ;
276285 Config {
277286 bless : matches. opt_present ( "bless" ) ,
278287 compile_lib_path : make_absolute ( opt_path ( matches, "compile-lib-path" ) ) ,
@@ -342,9 +351,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
342351 only_modified : matches. opt_present ( "only-modified" ) ,
343352 color,
344353 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,
348355 rustfix_coverage : matches. opt_present ( "rustfix-coverage" ) ,
349356 has_html_tidy,
350357 has_enzyme,
0 commit comments