@@ -456,9 +456,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Matches {
456456 }
457457
458458 fn check_local ( & mut self , cx : & LateContext < ' a , ' tcx > , local : & ' tcx Local < ' _ > ) {
459+ let local_span = cx. tcx . hir ( ) . span ( local. hir_id ) ;
459460 if_chain ! {
460- if !in_external_macro( cx. sess( ) , local . span ) ;
461- if !in_macro( local . span ) ;
461+ if !in_external_macro( cx. sess( ) , local_span ) ;
462+ if !in_macro( local_span ) ;
462463 if let Some ( ref expr) = local. init;
463464 if let ExprKind :: Match ( ref target, ref arms, MatchSource :: Normal ) = expr. kind;
464465 if arms. len( ) == 1 && arms[ 0 ] . guard. is_none( ) ;
@@ -475,7 +476,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Matches {
475476 span_lint_and_sugg(
476477 cx,
477478 INFALLIBLE_DESTRUCTURING_MATCH ,
478- local . span ,
479+ local_span ,
479480 "you seem to be trying to use `match` to destructure a single infallible pattern. \
480481 Consider using `let`",
481482 "try this" ,
@@ -1025,7 +1026,7 @@ fn check_match_single_binding<'a>(cx: &LateContext<'_, 'a>, ex: &Expr<'a>, arms:
10251026 // If this match is in a local (`let`) stmt
10261027 let ( target_span, sugg) = if let Some ( parent_let_node) = opt_parent_let ( cx, ex) {
10271028 (
1028- parent_let_node . span ,
1029+ cx . tcx . hir ( ) . span ( parent_let_node . hir_id ) ,
10291030 format ! (
10301031 "let {} = {};\n {}let {} = {};" ,
10311032 snippet_with_applicability( cx, bind_names, ".." , & mut applicability) ,
0 commit comments