@@ -40,27 +40,15 @@ declare_lint_pass!(NeedlessPathNew => [NEEDLESS_PATH_NEW]);
4040impl < ' tcx > LateLintPass < ' tcx > for NeedlessPathNew {
4141 fn check_expr ( & mut self , cx : & LateContext < ' tcx > , e : & ' tcx Expr < ' tcx > ) {
4242 match e. kind {
43- ExprKind :: Call ( fn_expr, args) if let ExprKind :: Path ( ref path) = fn_expr. kind => {
44- check_arguments (
45- cx,
46- & mut args. iter ( ) ,
47- cx. typeck_results ( ) . expr_ty ( fn_expr) ,
48- & rustc_hir_pretty:: qpath_to_string ( & cx. tcx , path) ,
49- "function" ,
50- ) ;
43+ ExprKind :: Call ( fn_expr, args) => {
44+ check_arguments ( cx, & mut args. iter ( ) , cx. typeck_results ( ) . expr_ty ( fn_expr) ) ;
5145 } ,
52- ExprKind :: MethodCall ( path , receiver, arguments, _)
46+ ExprKind :: MethodCall ( _ , receiver, arguments, _)
5347 if let Some ( def_id) = cx. typeck_results ( ) . type_dependent_def_id ( e. hir_id ) =>
5448 {
5549 let args = cx. typeck_results ( ) . node_args ( e. hir_id ) ;
5650 let method_type = cx. tcx . type_of ( def_id) . instantiate ( cx. tcx , args) ;
57- check_arguments (
58- cx,
59- & mut iter:: once ( receiver) . chain ( arguments. iter ( ) ) ,
60- method_type,
61- path. ident . as_str ( ) ,
62- "method" ,
63- ) ;
51+ check_arguments ( cx, & mut iter:: once ( receiver) . chain ( arguments. iter ( ) ) , method_type) ;
6452 } ,
6553 _ => ( ) ,
6654 }
@@ -71,8 +59,6 @@ fn check_arguments<'tcx>(
7159 cx : & LateContext < ' tcx > ,
7260 arguments : & mut dyn Iterator < Item = & ' tcx Expr < ' tcx > > ,
7361 type_definition : Ty < ' tcx > ,
74- name : & str ,
75- fn_kind : & str ,
7662) {
7763 let tcx = cx. tcx ;
7864 // whether `func` is `Path::new`
0 commit comments