about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Wright <mikerite@lavabit.com>2019-05-12 10:32:19 +0200
committerMichael Wright <mikerite@lavabit.com>2019-05-12 10:32:19 +0200
commit2efd8c6e05777a0245437e9b9d1e47431701faf0 (patch)
tree63d8ddd9e8263671321fd526f480d4d642a448d1
parente6e3f24e0cdea503be1a2e8c47297106d26d9aaa (diff)
downloadrust-2efd8c6e05777a0245437e9b9d1e47431701faf0.tar.gz
rust-2efd8c6e05777a0245437e9b9d1e47431701faf0.zip
Fix comments; minor refactoring
-rw-r--r--clippy_lints/src/methods/mod.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs
index be2b7a26e57..fb13598dea9 100644
--- a/clippy_lints/src/methods/mod.rs
+++ b/clippy_lints/src/methods/mod.rs
@@ -1060,13 +1060,15 @@ fn lint_or_fun_call<'a, 'tcx: 'a>(
 
     impl<'a, 'tcx> intravisit::Visitor<'tcx> for FunCallFinder<'a, 'tcx> {
         fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
-            let found = match &expr.node {
+            let call_found = match &expr.node {
+                // ignore enum and struct constructors
                 hir::ExprKind::Call(..) => !is_ctor_function(self.cx, expr),
                 hir::ExprKind::MethodCall(..) => true,
                 _ => false,
             };
 
-            if found {
+            if call_found {
+                // don't lint for constant values
                 let owner_def = self.cx.tcx.hir().get_parent_did_by_hir_id(expr.hir_id);
                 let promotable = self
                     .cx
@@ -1162,7 +1164,6 @@ fn lint_or_fun_call<'a, 'tcx: 'a>(
             return;
         }
 
-        // ignore enum and struct constructors
         let mut finder = FunCallFinder { cx: &cx, found: false };
         finder.visit_expr(&arg);
         if !finder.found {