Skip to content

Commit 2efd8c6

Browse files
author
Michael Wright
committed
Fix comments; minor refactoring
1 parent e6e3f24 commit 2efd8c6

File tree

1 file changed

+4
-3
lines changed
  • clippy_lints/src/methods

1 file changed

+4
-3
lines changed

clippy_lints/src/methods/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1060,13 +1060,15 @@ fn lint_or_fun_call<'a, 'tcx: 'a>(
10601060

10611061
impl<'a, 'tcx> intravisit::Visitor<'tcx> for FunCallFinder<'a, 'tcx> {
10621062
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
1063-
let found = match &expr.node {
1063+
let call_found = match &expr.node {
1064+
// ignore enum and struct constructors
10641065
hir::ExprKind::Call(..) => !is_ctor_function(self.cx, expr),
10651066
hir::ExprKind::MethodCall(..) => true,
10661067
_ => false,
10671068
};
10681069

1069-
if found {
1070+
if call_found {
1071+
// don't lint for constant values
10701072
let owner_def = self.cx.tcx.hir().get_parent_did_by_hir_id(expr.hir_id);
10711073
let promotable = self
10721074
.cx
@@ -1162,7 +1164,6 @@ fn lint_or_fun_call<'a, 'tcx: 'a>(
11621164
return;
11631165
}
11641166

1165-
// ignore enum and struct constructors
11661167
let mut finder = FunCallFinder { cx: &cx, found: false };
11671168
finder.visit_expr(&arg);
11681169
if !finder.found {

0 commit comments

Comments
 (0)