@@ -2,8 +2,8 @@ use super::utils::{LoopNestVisitor, Nesting};
2
2
use super :: WHILE_LET_ON_ITERATOR ;
3
3
use crate :: utils:: usage:: mutated_variables;
4
4
use crate :: utils:: {
5
- get_enclosing_block, get_trait_def_id , implements_trait, is_refutable, last_path_segment, match_trait_method ,
6
- path_to_local , path_to_local_id, paths , snippet_with_applicability, span_lint_and_sugg,
5
+ get_enclosing_block, implements_trait, is_refutable, is_trait_method , last_path_segment, path_to_local ,
6
+ path_to_local_id, snippet_with_applicability, span_lint_and_sugg,
7
7
} ;
8
8
use if_chain:: if_chain;
9
9
use rustc_errors:: Applicability ;
@@ -27,7 +27,7 @@ pub(super) fn check(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
27
27
// Don't lint when the iterator is recreated on every iteration
28
28
if_chain ! {
29
29
if let ExprKind :: MethodCall ( ..) | ExprKind :: Call ( ..) = iter_expr. kind;
30
- if let Some ( iter_def_id) = get_trait_def_id ( cx , & paths :: ITERATOR ) ;
30
+ if let Some ( iter_def_id) = cx . tcx . get_diagnostic_item ( sym :: Iterator ) ;
31
31
if implements_trait( cx, cx. typeck_results( ) . expr_ty( iter_expr) , iter_def_id, & [ ] ) ;
32
32
then {
33
33
return ;
@@ -36,7 +36,7 @@ pub(super) fn check(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
36
36
37
37
let lhs_constructor = last_path_segment ( qpath) ;
38
38
if method_path. ident . name == sym:: next
39
- && match_trait_method ( cx, match_expr, & paths :: ITERATOR )
39
+ && is_trait_method ( cx, match_expr, sym :: Iterator )
40
40
&& lhs_constructor. ident . name == sym:: Some
41
41
&& ( pat_args. is_empty ( )
42
42
|| !is_refutable ( cx, & pat_args[ 0 ] )
0 commit comments