Replace if-let by when-let since no else branches

for the recursive match by path example.
This commit is contained in:
Michael Salihi 2021-10-13 18:50:20 +02:00 committed by GitHub
parent 751ba17b75
commit 6c835e6e09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -143,10 +143,10 @@ As the `Match` contains all the route data, we can create a new matching functio
(require '[clojure.string :as str])
(defn recursive-match-by-path [router path]
(if-let [match (r/match-by-path router path)]
(when-let [match (r/match-by-path router path)]
(if-let [subrouter (-> match :data :router)]
(let [subpath (subs path (str/last-index-of (:template match) "/"))]
(if-let [submatch (recursive-match-by-path subrouter subpath)]
(when-let [submatch (recursive-match-by-path subrouter subpath)]
(cons match submatch)))
(list match))))
```