@@ -258,10 +258,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
258
258
hir:: Path { res : hir:: def:: Res :: Local ( hir_id) , .. } ,
259
259
) ) => {
260
260
if let Some ( hir:: Node :: Pat ( pat) ) = self . tcx . hir ( ) . find ( * hir_id) {
261
- let parent = self . tcx . hir ( ) . parent_id ( pat. hir_id ) ;
262
261
primary_span = pat. span ;
263
262
secondary_span = pat. span ;
264
- match self . tcx . hir ( ) . find ( parent ) {
263
+ match self . tcx . hir ( ) . find_parent ( pat . hir_id ) {
265
264
Some ( hir:: Node :: Local ( hir:: Local { ty : Some ( ty) , .. } ) ) => {
266
265
primary_span = ty. span ;
267
266
post_message = " type" ;
@@ -857,7 +856,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
857
856
_ => None ,
858
857
} ?;
859
858
860
- match hir. find ( hir . parent_id ( expr. hir_id ) ) ? {
859
+ match hir. find_parent ( expr. hir_id ) ? {
861
860
Node :: ExprField ( field) => {
862
861
if field. ident . name == local. name && field. is_shorthand {
863
862
return Some ( local. name ) ;
@@ -1040,7 +1039,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1040
1039
if let Some ( hir:: Node :: Expr ( hir:: Expr {
1041
1040
kind : hir:: ExprKind :: Assign ( ..) ,
1042
1041
..
1043
- } ) ) = self . tcx . hir ( ) . find ( self . tcx . hir ( ) . parent_id ( expr. hir_id ) )
1042
+ } ) ) = self . tcx . hir ( ) . find_parent ( expr. hir_id )
1044
1043
{
1045
1044
if mutability. is_mut ( ) {
1046
1045
// Suppressing this diagnostic, we'll properly print it in `check_expr_assign`
@@ -1267,9 +1266,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1267
1266
1268
1267
let mut sugg = vec ! [ ] ;
1269
1268
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 ) {
1273
1270
// `expr` is a literal field for a struct, only suggest if appropriate
1274
1271
if field. is_shorthand {
1275
1272
// This is a field literal
0 commit comments