From 4018c4fdefe4e88d417395e80bb9e8a434ce8664 Mon Sep 17 00:00:00 2001 From: Paul deGrandis Date: Thu, 8 Mar 2012 13:48:36 -0500 Subject: [PATCH 1/3] Pointless zero compare rule --- src/jonase/kibit/rules/arithmetic.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/jonase/kibit/rules/arithmetic.clj b/src/jonase/kibit/rules/arithmetic.clj index da64652..496102a 100644 --- a/src/jonase/kibit/rules/arithmetic.clj +++ b/src/jonase/kibit/rules/arithmetic.clj @@ -17,5 +17,6 @@ (< ?x 0) (neg? ?x) (= ?x ?x) true - (== ?x ?x) true}) + (== ?x ?x) true + (zero? 0) true}) From 9178c4dd4795e8b40660c1bfc045381847d1c2e2 Mon Sep 17 00:00:00 2001 From: Paul deGrandis Date: Thu, 8 Mar 2012 13:51:19 -0500 Subject: [PATCH 2/3] Pointless do, dead code when-not rules --- src/jonase/kibit/rules/control_structures.clj | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/jonase/kibit/rules/control_structures.clj b/src/jonase/kibit/rules/control_structures.clj index 1d611b6..bea1d4a 100644 --- a/src/jonase/kibit/rules/control_structures.clj +++ b/src/jonase/kibit/rules/control_structures.clj @@ -7,7 +7,9 @@ (if (not ?x) ?y ?z) (if-not ?x ?y ?z) (when (not ?x) . ?y) (when-not ?x ?y) (if true ?x ?y) ?x - (when true . ?x) (do . ?x)}) ; Maybe this should be (do ?x) + (when true . ?x) (do . ?x) + (do ?x) ?x + (when-not true ?x) "removing this dead code"}) (comment (when true From d299489f2023d577f55a27b124505b6fcb0cae22 Mon Sep 17 00:00:00 2001 From: Paul deGrandis Date: Thu, 8 Mar 2012 13:53:40 -0500 Subject: [PATCH 3/3] dead code when rule --- src/jonase/kibit/rules/control_structures.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/jonase/kibit/rules/control_structures.clj b/src/jonase/kibit/rules/control_structures.clj index bea1d4a..687385f 100644 --- a/src/jonase/kibit/rules/control_structures.clj +++ b/src/jonase/kibit/rules/control_structures.clj @@ -9,7 +9,8 @@ (if true ?x ?y) ?x (when true . ?x) (do . ?x) (do ?x) ?x - (when-not true ?x) "removing this dead code"}) + (when-not true ?x) "removing this dead code" + (when false ?x) "removing this dead code"}) (comment (when true