@@ -258,10 +258,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
258258 hir:: Path { res : hir:: def:: Res :: Local ( hir_id) , .. } ,
259259 ) ) => {
260260 if let Some ( hir:: Node :: Pat ( pat) ) = self . tcx . hir ( ) . find ( * hir_id) {
261- let parent = self . tcx . hir ( ) . parent_id ( pat. hir_id ) ;
262261 primary_span = pat. span ;
263262 secondary_span = pat. span ;
264- match self . tcx . hir ( ) . find ( parent ) {
263+ match self . tcx . hir ( ) . find_parent ( pat . hir_id ) {
265264 Some ( hir:: Node :: Local ( hir:: Local { ty : Some ( ty) , .. } ) ) => {
266265 primary_span = ty. span ;
267266 post_message = " type" ;
@@ -857,7 +856,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
857856 _ => None ,
858857 } ?;
859858
860- match hir. find ( hir . parent_id ( expr. hir_id ) ) ? {
859+ match hir. find_parent ( expr. hir_id ) ? {
861860 Node :: ExprField ( field) => {
862861 if field. ident . name == local. name && field. is_shorthand {
863862 return Some ( local. name ) ;
@@ -1040,7 +1039,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10401039 if let Some ( hir:: Node :: Expr ( hir:: Expr {
10411040 kind : hir:: ExprKind :: Assign ( ..) ,
10421041 ..
1043- } ) ) = self . tcx . hir ( ) . find ( self . tcx . hir ( ) . parent_id ( expr. hir_id ) )
1042+ } ) ) = self . tcx . hir ( ) . find_parent ( expr. hir_id )
10441043 {
10451044 if mutability. is_mut ( ) {
10461045 // Suppressing this diagnostic, we'll properly print it in `check_expr_assign`
@@ -1267,9 +1266,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12671266
12681267 let mut sugg = vec ! [ ] ;
12691268
1270- if let Some ( hir:: Node :: ExprField ( field) ) =
1271- self . tcx . hir ( ) . find ( self . tcx . hir ( ) . parent_id ( expr. hir_id ) )
1272- {
1269+ if let Some ( hir:: Node :: ExprField ( field) ) = self . tcx . hir ( ) . find_parent ( expr. hir_id ) {
12731270 // `expr` is a literal field for a struct, only suggest if appropriate
12741271 if field. is_shorthand {
12751272 // This is a field literal
0 commit comments