@@ -63,8 +63,8 @@ use clippy_utils::diagnostics::{span_lint, span_lint_and_help};
6363use clippy_utils:: source:: snippet_with_applicability;
6464use clippy_utils:: ty:: { contains_ty, implements_trait, is_copy, is_type_diagnostic_item} ;
6565use clippy_utils:: {
66- contains_return, get_trait_def_id, in_macro, iter_input_pats, match_def_path , match_qpath, method_calls,
67- method_chain_args , paths , return_ty , single_segment_path , SpanlessEq ,
66+ contains_return, get_trait_def_id, in_macro, iter_input_pats, match_qpath, method_calls, paths , return_ty ,
67+ SpanlessEq ,
6868} ;
6969use if_chain:: if_chain;
7070use rustc_ast:: ast;
@@ -1777,22 +1777,17 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
17771777
17781778 match expr. kind {
17791779 hir:: ExprKind :: Call ( ref func, ref args) => {
1780- if let hir:: ExprKind :: Path ( path) = & func. kind {
1781- if match_qpath ( path, & [ "from_iter" ] ) {
1782- from_iter_instead_of_collect:: check ( cx, expr, args) ;
1783- }
1784- }
1780+ from_iter_instead_of_collect:: check ( cx, expr, args, & func. kind ) ;
17851781 } ,
17861782 hir:: ExprKind :: MethodCall ( ref method_call, ref method_span, ref args, _) => {
17871783 or_fun_call:: check ( cx, expr, * method_span, & method_call. ident . as_str ( ) , args) ;
17881784 expect_fun_call:: check ( cx, expr, * method_span, & method_call. ident . as_str ( ) , args) ;
17891785 clone_on_copy:: check ( cx, expr, method_call. ident . name , args) ;
17901786 clone_on_ref_ptr:: check ( cx, expr, method_call. ident . name , args) ;
1791-
1792- let self_ty = cx. typeck_results ( ) . expr_ty_adjusted ( & args[ 0 ] ) ;
17931787 inefficient_to_string:: check ( cx, expr, method_call. ident . name , args) ;
17941788 single_char_add_str:: check ( cx, expr, args) ;
17951789
1790+ let self_ty = cx. typeck_results ( ) . expr_ty_adjusted ( & args[ 0 ] ) ;
17961791 match self_ty. kind ( ) {
17971792 ty:: Ref ( _, ty, _) if * ty. kind ( ) == ty:: Str => {
17981793 for & ( method, pos) in & PATTERN_METHODS {
0 commit comments