@@ -27,7 +27,7 @@ fn check_needless_collect_direct_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCont
2727 if chain_method. ident. name == sym!( collect) && is_trait_method( cx, & args[ 0 ] , sym:: Iterator ) ;
2828 if let Some ( generic_args) = chain_method. args;
2929 if let Some ( GenericArg :: Type ( ref ty) ) = generic_args. args. get( 0 ) ;
30- let ty = cx. typeck_results( ) . node_type ( ty. hir_id) ;
30+ if let Some ( ty ) = cx. typeck_results( ) . node_type_opt ( ty. hir_id) ;
3131 if is_type_diagnostic_item( cx, ty, sym:: vec_type)
3232 || is_type_diagnostic_item( cx, ty, sym:: vecdeque_type)
3333 || match_type( cx, ty, & paths:: BTREEMAP )
@@ -82,7 +82,7 @@ fn check_needless_collect_indirect_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCo
8282 if let ExprKind :: MethodCall ( method_name, collect_span, & [ ref iter_source] , ..) = init_expr. kind;
8383 if method_name. ident. name == sym!( collect) && is_trait_method( cx, init_expr, sym:: Iterator ) ;
8484 if let Some ( hir_id) = get_hir_id( * ty, method_name. args) ;
85- if let ty = cx. typeck_results( ) . node_type ( hir_id) ;
85+ if let Some ( ty ) = cx. typeck_results( ) . node_type_opt ( hir_id) ;
8686 if is_type_diagnostic_item( cx, ty, sym:: vec_type) ||
8787 is_type_diagnostic_item( cx, ty, sym:: vecdeque_type) ||
8888 is_type_diagnostic_item( cx, ty, sym:: BinaryHeap ) ||
0 commit comments