Skip to content

Commit

Permalink
prefer (seq x) over (not (empty? x))
Browse files Browse the repository at this point in the history
  • Loading branch information
miner committed Jul 8, 2012
1 parent dacbdd1 commit cc83a68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/kibit/rules/collections.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
[(conj [] . ?x) (vector . ?x)]
[(into [] ?coll) (vec ?coll)]

;; empty?
[(not (empty? ?x)) (seq ?x)]

;; set
[(into #{} ?coll) (set ?coll)])

1 change: 1 addition & 0 deletions test/kibit/test/collections.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
(deftest collections-are
(are [expected-alt-form test-form]
(= expected-alt-form (:alt (kibit/check-expr test-form)))
'(seq a) '(not (empty? a))
'(vector a) '(conj [] a)
'(vector a b) '(conj [] a b)
'(vec coll) '(into [] coll)
Expand Down

0 comments on commit cc83a68

Please sign in to comment.