taoensso / timbre

Pure Clojure/Script logging library
https://www.taoensso.com/timbre
Eclipse Public License 1.0
1.44k stars 171 forks source link

defnp macro and eastwood warning #59

Closed ducky427 closed 10 years ago

ducky427 commented 10 years ago

Hello, I am using the defnp macro from taoensso.timbre.profiling v3.1.6. When I run in through eastwood, I get a warning:

{:linter :unused-ret-vals,
 :msg
 "Constant value is discarded inside null: nil (nil value is returned by comment and gen-class expressions)",
 :line nil,
 :column nil}

I tried to examine what was happening. So I did a macroexpand on a simple function:

(macroexpand '(defnp foo [x] (* x x)))

The result is:

(def foo (clojure.core/fn ([x] nil (taoensso.timbre.profiling/pspy "foo" (* x x)))))

I am guessing the nil generated is what is tripping eastwood.

ducky427 commented 10 years ago

Looking at the defnp macro, the issue may be ~prepost-map

ptaoussanis commented 10 years ago

Hi Ducky,

I'm not familiar with Eastwood. Will it still complain if an empty pre/post map is given instead of a nil? Assuming it helps, would be happy to take a PR that swaps ~(or prepost-map {}) for ~prepost-map.

Cheers! :-)

ducky427 commented 10 years ago

That fixes it. Thanks!

I am just sending you a PR.