@@ -7,7 +7,7 @@ use rustc_hir::def::{CtorKind, DefKind, Res};
77use rustc_hir:: def_id:: DefId ;
88use rustc_hir:: { Expr , ExprKind , QPath } ;
99use rustc_lint:: { LateContext , LateLintPass } ;
10- use rustc_middle:: ty:: { self , List , ParamTy , Ty , TyCtxt } ;
10+ use rustc_middle:: ty:: { self , GenericPredicates , List , ParamTy , Ty , TyCtxt } ;
1111use rustc_session:: impl_lint_pass;
1212use rustc_span:: sym;
1313use std:: iter;
@@ -114,6 +114,8 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPathNew<'tcx> {
114114 } )
115115 } ;
116116
117+ let has_required_preds = |_param_ty : & ParamTy /* , _preds: GenericPredicates<'_> */ | -> bool { true } ;
118+
117119 // as far as I understand, `ExprKind::MethodCall` doesn't include the receiver in `args`,
118120 // but does in `sig.inputs()` -- so we iterate over both in `rev`erse in order to line
119121 // them up starting from the _end_
@@ -127,7 +129,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPathNew<'tcx> {
127129 && is_path_new ( path_new)
128130 && let ty:: Param ( arg_param_ty) = arg_ty. kind ( )
129131 && !is_used_anywhere_else ( arg_param_ty, sig. inputs ( ) )
130- && implements_asref_path ( * arg_ty)
132+ && has_required_preds ( arg_param_ty /* , cx.tcx.predicates_of( arg_ty) */ )
131133 {
132134 span_lint_and_sugg (
133135 cx,
0 commit comments