@@ -40,27 +40,15 @@ declare_lint_pass!(NeedlessPathNew => [NEEDLESS_PATH_NEW]);
40
40
impl < ' tcx > LateLintPass < ' tcx > for NeedlessPathNew {
41
41
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , e : & ' tcx Expr < ' tcx > ) {
42
42
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) ) ;
51
45
} ,
52
- ExprKind :: MethodCall ( path , receiver, arguments, _)
46
+ ExprKind :: MethodCall ( _ , receiver, arguments, _)
53
47
if let Some ( def_id) = cx. typeck_results ( ) . type_dependent_def_id ( e. hir_id ) =>
54
48
{
55
49
let args = cx. typeck_results ( ) . node_args ( e. hir_id ) ;
56
50
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) ;
64
52
} ,
65
53
_ => ( ) ,
66
54
}
@@ -71,8 +59,6 @@ fn check_arguments<'tcx>(
71
59
cx : & LateContext < ' tcx > ,
72
60
arguments : & mut dyn Iterator < Item = & ' tcx Expr < ' tcx > > ,
73
61
type_definition : Ty < ' tcx > ,
74
- name : & str ,
75
- fn_kind : & str ,
76
62
) {
77
63
let tcx = cx. tcx ;
78
64
// whether `func` is `Path::new`
0 commit comments