@@ -226,12 +226,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
226
226
let [ hir:: PathSegment { ident, args : None , .. } ] = p. segments else { return false ; } ;
227
227
let hir:: def:: Res :: Local ( hir_id) = p. res else { return false ; } ;
228
228
let Some ( hir:: Node :: Pat ( pat) ) = map. find ( hir_id) else { return false ; } ;
229
- let parent = map. get_parent_node ( pat. hir_id ) ;
230
229
let Some ( hir:: Node :: Local ( hir:: Local {
231
230
ty : None ,
232
231
init : Some ( init) ,
233
232
..
234
- } ) ) = map. find ( parent ) else { return false ; } ;
233
+ } ) ) = map. find_parent ( pat . hir_id ) else { return false ; } ;
235
234
let Some ( ty) = self . node_ty_opt ( init. hir_id ) else { return false ; } ;
236
235
if ty. is_closure ( ) || init. span . overlaps ( expr. span ) || pat. span . from_expansion ( ) {
237
236
return false ;
@@ -285,12 +284,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
285
284
// In every expression where the binding is referenced, we will look at that
286
285
// expression's type and see if it is where the incorrect found type was fully
287
286
// "materialized" and point at it. We will also try to provide a suggestion there.
288
- let parent = map. get_parent_node ( binding. hir_id ) ;
289
- if let Some ( hir:: Node :: Expr ( expr) )
290
- | Some ( hir:: Node :: Stmt ( hir:: Stmt {
287
+ if let Some ( hir:: Node :: Expr ( expr)
288
+ | hir:: Node :: Stmt ( hir:: Stmt {
291
289
kind : hir:: StmtKind :: Expr ( expr) | hir:: StmtKind :: Semi ( expr) ,
292
290
..
293
- } ) ) = & map. find ( parent )
291
+ } ) ) = & map. find_parent ( binding . hir_id )
294
292
&& let hir:: ExprKind :: MethodCall ( segment, rcvr, args, _span) = expr. kind
295
293
&& rcvr. hir_id == binding. hir_id
296
294
&& let Some ( def_id) = self . typeck_results . borrow ( ) . type_dependent_def_id ( expr. hir_id )
0 commit comments