@@ -1276,47 +1276,43 @@ fn get_diagnostic_from_import_name_result_pattern(
12761276 diagnostic_pattern ( span, pattern. message . clone ( ) , source)
12771277 }
12781278 ImportNameResult :: DefaultDisallowed => {
1279- let diagnostic = match & pattern. import_names {
1280- Some ( import_names ) => diagnostic_pattern_and_everything (
1279+ if let Some ( import_names ) = & pattern. import_names {
1280+ return diagnostic_pattern_and_everything (
12811281 span,
12821282 pattern. message . clone ( ) ,
12831283 import_names. join ( ", " ) . as_str ( ) ,
12841284 source,
1285- ) ,
1286- _ => match & pattern. import_name_pattern {
1287- Some ( import_name_patterns) => {
1288- diagnostic_pattern_and_everything_with_regex_import_name (
1289- span,
1290- pattern. message . clone ( ) ,
1291- import_name_patterns,
1292- source,
1293- )
1294- }
1295- _ => match & pattern. allow_import_name_pattern {
1296- Some ( allow_import_name_pattern) => {
1297- diagnostic_everything_with_allowed_import_name_pattern (
1298- span,
1299- pattern. message . clone ( ) ,
1300- source,
1301- allow_import_name_pattern. as_str ( ) ,
1302- )
1303- }
1304- _ => match & pattern. allow_import_names {
1305- Some ( allowed_import_names) => {
1306- diagnostic_everything_with_allowed_import_name (
1307- span,
1308- pattern. message . clone ( ) ,
1309- source,
1310- allowed_import_names. join ( ", " ) . as_str ( ) ,
1311- )
1312- }
1313- _ => diagnostic_pattern ( span, pattern. message . clone ( ) , source) ,
1314- } ,
1315- } ,
1316- } ,
1317- } ;
1285+ ) ;
1286+ }
1287+
1288+ if let Some ( import_name_patterns) = & pattern. import_name_pattern {
1289+ return diagnostic_pattern_and_everything_with_regex_import_name (
1290+ span,
1291+ pattern. message . clone ( ) ,
1292+ import_name_patterns,
1293+ source,
1294+ ) ;
1295+ }
13181296
1319- diagnostic
1297+ if let Some ( allow_import_name_pattern) = & pattern. allow_import_name_pattern {
1298+ return diagnostic_everything_with_allowed_import_name_pattern (
1299+ span,
1300+ pattern. message . clone ( ) ,
1301+ source,
1302+ allow_import_name_pattern. as_str ( ) ,
1303+ ) ;
1304+ }
1305+
1306+ if let Some ( allowed_import_names) = & pattern. allow_import_names {
1307+ return diagnostic_everything_with_allowed_import_name (
1308+ span,
1309+ pattern. message . clone ( ) ,
1310+ source,
1311+ allowed_import_names. join ( ", " ) . as_str ( ) ,
1312+ ) ;
1313+ }
1314+
1315+ diagnostic_pattern ( span, pattern. message . clone ( ) , source)
13201316 }
13211317 ImportNameResult :: NameDisallowed ( name_span) => match & pattern. allow_import_names {
13221318 Some ( allow_import_names) => diagnostic_allowed_import_name (
0 commit comments