@@ -672,11 +672,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
672
672
} ;
673
673
(
674
674
true ,
675
- td. as_local ( ) . and_then ( |tld| match self . infcx . tcx . opt_hir_node_by_def_id ( tld) {
676
- Some ( Node :: Item ( hir:: Item {
677
- kind : hir:: ItemKind :: Trait ( _, _, _, _, items) ,
678
- ..
679
- } ) ) => {
675
+ td. as_local ( ) . and_then ( |tld| match self . infcx . tcx . hir_node_by_def_id ( tld) {
676
+ Node :: Item ( hir:: Item { kind : hir:: ItemKind :: Trait ( _, _, _, _, items) , .. } ) => {
680
677
let mut f_in_trait_opt = None ;
681
678
for hir:: TraitItemRef { id : fi, kind : k, .. } in * items {
682
679
let hi = fi. hir_id ( ) ;
@@ -1475,11 +1472,9 @@ fn get_mut_span_in_struct_field<'tcx>(
1475
1472
if let ty:: Ref ( _, ty, _) = ty. kind ( )
1476
1473
&& let ty:: Adt ( def, _) = ty. kind ( )
1477
1474
&& let field = def. all_fields ( ) . nth ( field. index ( ) ) ?
1478
- // Use the HIR types to construct the diagnostic message.
1479
- && let node = tcx. opt_hir_node_by_def_id ( field. did . as_local ( ) ?) ?
1480
1475
// Now we're dealing with the actual struct that we're going to suggest a change to,
1481
1476
// we can expect a field that is an immutable reference to a type.
1482
- && let hir:: Node :: Field ( field) = node
1477
+ && let hir:: Node :: Field ( field) = tcx . hir_node_by_def_id ( field . did . as_local ( ) ? )
1483
1478
&& let hir:: TyKind :: Ref ( lt, hir:: MutTy { mutbl : hir:: Mutability :: Not , ty } ) = field. ty . kind
1484
1479
{
1485
1480
return Some ( lt. ident . span . between ( ty. span ) ) ;
0 commit comments