Skip to content

Commit cdbcdd1

Browse files
committed
only get bounds once
1 parent 0cc146e commit cdbcdd1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clippy_lints/src/needless_path_new.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,16 @@ fn check_arguments<'tcx>(
8787

8888
if let ty::FnDef(def_id, ..) = type_definition.kind() {
8989
let parameters = dbg!(type_definition.fn_sig(tcx)).skip_binder().inputs();
90+
91+
let bounds = tcx.param_env(def_id).caller_bounds();
92+
dbg!(bounds);
93+
9094
for (argument, parameter) in iter::zip(arguments, parameters) {
9195
if let ExprKind::Call(func, args) = argument.kind
9296
&& is_path_new(func)
9397
&& implements_asref_path(cx.typeck_results().expr_ty(&args[0]))
9498
&& implements_asref_path(*parameter)
9599
{
96-
let bounds = tcx.param_env(def_id).caller_bounds();
97-
dbg!(bounds);
98100
span_lint_and_sugg(
99101
cx,
100102
NEEDLESS_PATH_NEW,

0 commit comments

Comments
 (0)