Merge pull request #69 from pangloss/master

Rule for redundant do inside a when
This commit is contained in:
Jonas Enlund 2013-01-25 21:42:28 -08:00
commit 18349920b4
2 changed files with 5 additions and 1 deletions

View file

@ -14,6 +14,8 @@
[(when-not true ?x) _]
[(when false ?x) _]
[(if-let ?binding ?expr nil) (when-let ?binding ?expr)]
[(when ?x (do . ?y)) (when ?x . ?y)]
[(when-not ?x (do . ?y)) (when-not ?x . ?y)]
;; suggest `while` for bindingless loop-recur
[(loop [] (when ?test . ?exprs (recur)))
@ -41,4 +43,4 @@
(action d)
(action f))
nil))

View file

@ -18,6 +18,8 @@
'_ '(when false anything)
'(when-let [a test] expr) '(if-let [a test] expr nil)
'(let [a 1] (println a) a) '(let [a 1] (do (println a) a))
'(when test (println a) then) '(when test (do (println a) then))
'(when-not test (println a) then) '(when-not test (do (println a) then))
'(loop [a 4] (println a) (if (zero? a) a (recur (dec a))))
'(loop [a 4] (do (println a) (if (zero? a) a (recur (dec a)))))))