@@ -171,7 +171,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
171171 if fieldpat. is_shorthand {
172172 continue ;
173173 }
174- if fieldpat. span . from_expansion ( ) {
174+ let fieldpat_span = cx. tcx . hir ( ) . span ( fieldpat. hir_id ) ;
175+ if fieldpat_span. from_expansion ( ) {
175176 // Don't lint if this is a macro expansion: macro authors
176177 // shouldn't have to worry about this kind of style issue
177178 // (Issue #49588)
@@ -181,7 +182,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
181182 if cx. tcx . find_field_index ( ident, & variant)
182183 == Some ( cx. tcx . field_index ( fieldpat. hir_id , cx. tables ) )
183184 {
184- cx. struct_span_lint ( NON_SHORTHAND_FIELD_PATTERNS , fieldpat . span , |lint| {
185+ cx. struct_span_lint ( NON_SHORTHAND_FIELD_PATTERNS , fieldpat_span , |lint| {
185186 let mut err = lint
186187 . build ( & format ! ( "the `{}:` in this pattern is redundant" , ident) ) ;
187188 let binding = match binding_annot {
@@ -196,7 +197,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
196197 ident. to_string ( )
197198 } ;
198199 err. span_suggestion (
199- fieldpat . span ,
200+ fieldpat_span ,
200201 "use shorthand field pattern" ,
201202 ident,
202203 Applicability :: MachineApplicable ,
0 commit comments