@@ -1432,20 +1432,26 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
1432
1432
if let Some ( ( start, end, join) ) = endpoints {
1433
1433
let msg = "`...` range patterns are deprecated" ;
1434
1434
let suggestion = "use `..=` for an inclusive range" ;
1435
- let ( span , replacement ) = if parenthesise {
1435
+ if parenthesise {
1436
1436
* visit_subpats = false ;
1437
- ( pat. span , format ! ( "&({}..={})" , expr_to_string( & start) , expr_to_string( & end) ) )
1437
+ let mut err = cx. struct_span_lint ( ELLIPSIS_INCLUSIVE_RANGE_PATTERNS , pat. span , msg) ;
1438
+ err. span_suggestion_with_applicability (
1439
+ pat. span ,
1440
+ suggestion,
1441
+ format ! ( "&({}..={})" , expr_to_string( & start) , expr_to_string( & end) ) ,
1442
+ Applicability :: MachineApplicable ,
1443
+ ) ;
1444
+ err. emit ( ) ;
1438
1445
} else {
1439
- ( join, "..=" . to_owned ( ) )
1446
+ let mut err = cx. struct_span_lint ( ELLIPSIS_INCLUSIVE_RANGE_PATTERNS , join, msg) ;
1447
+ err. span_suggestion_short_with_applicability (
1448
+ join,
1449
+ suggestion,
1450
+ "..=" . to_owned ( ) ,
1451
+ Applicability :: MachineApplicable ,
1452
+ ) ;
1453
+ err. emit ( ) ;
1440
1454
} ;
1441
- let mut err = cx. struct_span_lint ( ELLIPSIS_INCLUSIVE_RANGE_PATTERNS , span, msg) ;
1442
- err. span_suggestion_short_with_applicability (
1443
- span,
1444
- suggestion,
1445
- replacement,
1446
- Applicability :: MachineApplicable ,
1447
- ) ;
1448
- err. emit ( ) ;
1449
1455
}
1450
1456
}
1451
1457
}
0 commit comments