Skip to content

Commit 5aa8def

Browse files
committed
rewrite motivation for the args.len() == 1 check
it was recommended on Zulip to keep the check, so do that and give the motivation for having it
1 parent d519de6 commit 5aa8def

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clippy_lints/src/needless_path_new.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ fn check_arguments<'tcx>(
106106
for (argument, parameter) in iter::zip(arguments, parameters) {
107107
if let ExprKind::Call(func, args) = argument.kind
108108
&& is_path_new(func)
109-
// I guess this check is superfluous,
110-
// since we know how many parameters `Path::new` takes
109+
// just to be extra sure that we have a correctly formed `Path::new(x)` call
111110
&& args.len() == 1
112111
&& implements_asref_path(cx.typeck_results().expr_ty(&args[0]))
113112
&& implements_asref_path(*parameter)

0 commit comments

Comments
 (0)