Skip to content

Commit a30c30e

Browse files
committed
Collapse reject+filter into single filter in best_prefix_match
1 parent 19040f6 commit a30c30e

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

lib/backpex/preferences/router.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,7 @@ defmodule Backpex.Preferences.Router do
378378
# but not others, which contradicts the single-owner semantics that
379379
# get_map/3 relies on. Only string patterns and :default participate here.
380380
routes
381-
|> Enum.reject(&match_fun_route?/1)
382-
|> Enum.filter(&prefix_matches?(&1, prefix, prefix_segments))
381+
|> Enum.filter(&(not match_fun_route?(&1) and prefix_matches?(&1, prefix, prefix_segments)))
383382
|> Enum.max_by(&prefix_specificity(&1, prefix_segments), fn -> nil end)
384383
end
385384

0 commit comments

Comments
 (0)