@@ -2,8 +2,8 @@ use super::NEEDLESS_COLLECT;
2
2
use clippy_utils:: diagnostics:: { span_lint_and_sugg, span_lint_and_then} ;
3
3
use clippy_utils:: source:: snippet;
4
4
use clippy_utils:: sugg:: Sugg ;
5
- use clippy_utils:: ty:: { is_type_diagnostic_item, match_type } ;
6
- use clippy_utils:: { is_trait_method, path_to_local_id, paths } ;
5
+ use clippy_utils:: ty:: is_type_diagnostic_item;
6
+ use clippy_utils:: { is_trait_method, path_to_local_id} ;
7
7
use if_chain:: if_chain;
8
8
use rustc_errors:: Applicability ;
9
9
use rustc_hir:: intravisit:: { walk_block, walk_expr, NestedVisitorMap , Visitor } ;
@@ -30,7 +30,7 @@ fn check_needless_collect_direct_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCont
30
30
then {
31
31
let is_empty_sugg = Some ( "next().is_none()" . to_string( ) ) ;
32
32
let method_name = & * method. ident. name. as_str( ) ;
33
- let sugg = if is_type_diagnostic_item( cx, ty, sym:: vec_type) ||
33
+ let sugg = if is_type_diagnostic_item( cx, ty, sym:: vec_type) ||
34
34
is_type_diagnostic_item( cx, ty, sym:: vecdeque_type) {
35
35
match method_name {
36
36
"len" => Some ( "count()" . to_string( ) ) ,
@@ -45,7 +45,7 @@ fn check_needless_collect_direct_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCont
45
45
_ => None ,
46
46
}
47
47
}
48
- else if match_type ( cx, ty, & paths :: BTREEMAP ) ||
48
+ else if is_type_diagnostic_item ( cx, ty, sym :: BTreeMap ) ||
49
49
is_type_diagnostic_item( cx, ty, sym:: hashmap_type) {
50
50
match method_name {
51
51
"is_empty" => is_empty_sugg,
@@ -98,7 +98,7 @@ fn check_needless_collect_indirect_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCo
98
98
if is_type_diagnostic_item( cx, ty, sym:: vec_type) ||
99
99
is_type_diagnostic_item( cx, ty, sym:: vecdeque_type) ||
100
100
is_type_diagnostic_item( cx, ty, sym:: BinaryHeap ) ||
101
- match_type ( cx, ty, & paths :: LINKED_LIST ) ;
101
+ is_type_diagnostic_item ( cx, ty, sym :: LinkedList ) ;
102
102
if let Some ( iter_calls) = detect_iter_and_into_iters( block, * ident) ;
103
103
if let [ iter_call] = & * iter_calls;
104
104
then {
0 commit comments