@@ -608,9 +608,10 @@ impl<'tcx> LateLintPass<'tcx> for Matches {
608608 }
609609
610610 fn check_local ( & mut self , cx : & LateContext < ' tcx > , local : & ' tcx Local < ' _ > ) {
611+ let local_span = cx. tcx . hir ( ) . span ( local. hir_id ) ;
611612 if_chain ! {
612- if !in_external_macro( cx. sess( ) , local . span ) ;
613- if !in_macro( local . span ) ;
613+ if !in_external_macro( cx. sess( ) , local_span ) ;
614+ if !in_macro( local_span ) ;
614615 if let Some ( ref expr) = local. init;
615616 if let ExprKind :: Match ( ref target, ref arms, MatchSource :: Normal ) = expr. kind;
616617 if arms. len( ) == 1 && arms[ 0 ] . guard. is_none( ) ;
@@ -627,7 +628,7 @@ impl<'tcx> LateLintPass<'tcx> for Matches {
627628 span_lint_and_sugg(
628629 cx,
629630 INFALLIBLE_DESTRUCTURING_MATCH ,
630- local . span ,
631+ local_span ,
631632 "you seem to be trying to use `match` to destructure a single infallible pattern. \
632633 Consider using `let`",
633634 "try this" ,
@@ -1340,7 +1341,7 @@ fn check_match_single_binding<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[A
13401341 // If this match is in a local (`let`) stmt
13411342 let ( target_span, sugg) = if let Some ( parent_let_node) = opt_parent_let ( cx, ex) {
13421343 (
1343- parent_let_node . span ,
1344+ cx . tcx . hir ( ) . span ( parent_let_node . hir_id ) ,
13441345 format ! (
13451346 "let {} = {};\n {}let {} = {};" ,
13461347 snippet_with_applicability( cx, bind_names, ".." , & mut applicability) ,
0 commit comments