@@ -5,7 +5,7 @@ use clippy_utils::ty::implements_trait;
55use rustc_errors:: Applicability ;
66use rustc_hir:: { Expr , ExprKind , QPath } ;
77use rustc_lint:: { LateContext , LateLintPass } ;
8- use rustc_middle:: ty:: { List , Ty } ;
8+ use rustc_middle:: ty:: { self , List , Ty } ;
99use rustc_session:: declare_lint_pass;
1010use rustc_span:: sym;
1111use std:: iter;
@@ -85,14 +85,16 @@ fn check_arguments<'tcx>(
8585
8686 let implements_asref_path = |arg| implements_trait ( cx, arg, asref_def_id, & [ path_ty. into ( ) ] ) ;
8787
88- if type_definition. is_fn ( ) {
89- let parameters = type_definition. fn_sig ( tcx) . skip_binder ( ) . inputs ( ) ;
88+ if let ty :: FnDef ( def_id , .. ) = type_definition. kind ( ) {
89+ let parameters = dbg ! ( type_definition. fn_sig( tcx) ) . skip_binder ( ) . inputs ( ) ;
9090 for ( argument, parameter) in iter:: zip ( arguments, parameters) {
9191 if let ExprKind :: Call ( func, args) = argument. kind
9292 && is_path_new ( func)
9393 && implements_asref_path ( cx. typeck_results ( ) . expr_ty ( & args[ 0 ] ) )
9494 && implements_asref_path ( * parameter)
9595 {
96+ let bounds = tcx. param_env ( def_id) . caller_bounds ( ) ;
97+ dbg ! ( bounds) ;
9698 span_lint_and_sugg (
9799 cx,
98100 NEEDLESS_PATH_NEW ,
0 commit comments