Skip to content

Commit 9f9739d

Browse files
committed
misc: pull if into match arm
1 parent 44b2b90 commit 9f9739d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

clippy_lints/src/needless_path_new.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@ declare_lint_pass!(NeedlessPathNew => [NEEDLESS_PATH_NEW]);
4040
impl<'tcx> LateLintPass<'tcx> for NeedlessPathNew {
4141
fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) {
4242
match e.kind {
43-
ExprKind::Call(fn_expr, args) => {
44-
if let ExprKind::Path(ref path) = fn_expr.kind {
45-
check_arguments(
46-
cx,
47-
&mut args.iter(),
48-
cx.typeck_results().expr_ty(fn_expr),
49-
&rustc_hir_pretty::qpath_to_string(&cx.tcx, path),
50-
"function",
51-
);
52-
}
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+
);
5351
},
5452
ExprKind::MethodCall(path, receiver, arguments, _)
5553
if let Some(def_id) = cx.typeck_results().type_dependent_def_id(e.hir_id) =>

0 commit comments

Comments
 (0)