Skip to content

Commit 74888d9

Browse files
committed
Remove some useless code
I had completely forgotten nREPL that clojure.walk/keywordize-keys worked recursively and nREPL already calls it for each incoming request map.
1 parent 5ee25ed commit 74888d9

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

src/cider/nrepl.clj

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
(def wrap-pprint-fn-optional-arguments
8383
"Common pprint arguments for CIDER's middleware."
8484
{"pprint-fn" "The namespace-qualified name of a 1 or 2-arity function to use for pretty-printing. Defaults to `cider.nrepl.pprint/pprint`."
85-
"print-params" "A map of configuration entries that the pprint-fn will understand. Those would typically be specific to the pprint-fn in question."})
85+
"print-options" "A map of configuration entries that the pprint-fn will understand. Those would typically be specific to the pprint-fn in question."})
8686

8787
(def-wrapper wrap-pprint-fn cider.nrepl.middleware.pprint/handle-pprint-fn
8888
(fn [msg] true)
@@ -94,15 +94,13 @@
9494
`cider.nrepl.pprint/pprint`. The function name can be passed as
9595
a string or symbol. Note that function should take 1 or two params - the
9696
object to print and the an optional map of print params. The params should
97-
be passed as `:print-params` - a map of key/value params. If they were passed
98-
by the client as with string keys, this middleware will convert the keys to
99-
keywords.
97+
be passed as `:print-options` - a map of key/value params.
10098
10199
The `:pprint-fn` slot will be replaced with the var that maps to the name
102100
that was initially passed.
103101
104102
Middlewares further down the stack can then look up the `:pprint-fn`
105-
slot, call it where necessary, and pass it the value of the `:print-params` slot."
103+
slot, call it where necessary, and pass it the value of the `:print-options` slot."
106104
:requires #{#'session}
107105
:expects #{"eval" "load-file"}})
108106

src/cider/nrepl/middleware/pprint.clj

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
(:require
33
[cider.nrepl.middleware.util.cljs :as cljs]
44
cider.nrepl.pprint
5-
[clojure.walk :as walk]
65
[nrepl.middleware.interruptible-eval :refer [*msg*]]
76
[nrepl.middleware.pr-values :refer [pr-values]]
87
[nrepl.middleware.session :as session]
@@ -26,9 +25,7 @@
2625

2726
(defn handle-pprint-fn
2827
[handler msg]
29-
(let [{:keys [pprint-fn print-options session]
28+
(let [{:keys [pprint-fn]
3029
:or {pprint-fn 'cider.nrepl.pprint/pprint}}
3130
msg]
32-
(handler (assoc msg
33-
:pprint-fn (resolve-pprint-fn pprint-fn)
34-
:print-options (walk/keywordize-keys print-options)))))
31+
(handler (assoc msg :pprint-fn (resolve-pprint-fn pprint-fn)))))

src/cider/nrepl/pprint.clj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
All functions here are simple wrappers that ensure a consistent API:
44
55
* has one and two params signatures - object to print and a map of print options
6-
* the keys of the print options map can be strings, as bencode clients can't send keywords
76
* functions return the printed object as a string"
87
{:added "0.20.0"}
98
(:require
10-
[clojure.pprint :as pp]
11-
[clojure.walk :as walk]))
9+
[clojure.pprint :as pp]))
1210

1311
(defn pprint
1412
"A simple wrapper around `clojure.pprint/write`.
@@ -17,7 +15,7 @@
1715
([object]
1816
(pprint object {}))
1917
([object opts]
20-
(let [opts (assoc (walk/keywordize-keys opts) :stream nil)]
18+
(let [opts (assoc opts :stream nil)]
2119
(apply pp/write object (vec (flatten (vec opts)))))))
2220

2321
(def ^:private fipp-printer
@@ -31,7 +29,7 @@
3129
(fipp-pprint object {}))
3230
([object opts]
3331
(with-out-str
34-
(@fipp-printer object (walk/keywordize-keys opts)))))
32+
(@fipp-printer object opts))))
3533

3634
(def ^:private puget-printer
3735
(delay
@@ -43,4 +41,4 @@
4341
([object]
4442
(puget-pprint object {}))
4543
([object opts]
46-
(@puget-printer object (walk/keywordize-keys opts))))
44+
(@puget-printer object opts)))

0 commit comments

Comments
 (0)