@@ -2,8 +2,8 @@ use super::NEEDLESS_COLLECT;
22use clippy_utils:: diagnostics:: { span_lint_and_sugg, span_lint_and_then} ;
33use clippy_utils:: source:: snippet;
44use 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} ;
77use if_chain:: if_chain;
88use rustc_errors:: Applicability ;
99use 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
3030 then {
3131 let is_empty_sugg = Some ( "next().is_none()" . to_string( ) ) ;
3232 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) ||
3434 is_type_diagnostic_item( cx, ty, sym:: vecdeque_type) {
3535 match method_name {
3636 "len" => Some ( "count()" . to_string( ) ) ,
@@ -45,7 +45,7 @@ fn check_needless_collect_direct_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCont
4545 _ => None ,
4646 }
4747 }
48- else if match_type ( cx, ty, & paths :: BTREEMAP ) ||
48+ else if is_type_diagnostic_item ( cx, ty, sym :: BTreeMap ) ||
4949 is_type_diagnostic_item( cx, ty, sym:: hashmap_type) {
5050 match method_name {
5151 "is_empty" => is_empty_sugg,
@@ -98,7 +98,7 @@ fn check_needless_collect_indirect_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCo
9898 if is_type_diagnostic_item( cx, ty, sym:: vec_type) ||
9999 is_type_diagnostic_item( cx, ty, sym:: vecdeque_type) ||
100100 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 ) ;
102102 if let Some ( iter_calls) = detect_iter_and_into_iters( block, * ident) ;
103103 if let [ iter_call] = & * iter_calls;
104104 then {
0 commit comments