Permalink
Browse files

Use `break` instead of `next` in AD::Journey::Formatter#match_route

The array is sorted in descending order, so there is no point in
iterating further if we met a negative item - all the rest will be
negative too.
  • Loading branch information...
1 parent 66dd216 commit eba8b70d4ec7239694b026bef3c07e5ad82efe69 @DNNX DNNX committed May 22, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 actionpack/lib/action_dispatch/journey/formatter.rb
@@ -85,7 +85,7 @@ def match_route(name, options)
hash = routes.group_by { |_, r| r.score(options) }
hash.keys.sort.reverse_each do |score|
- next if score < 0
+ break if score < 0
hash[score].sort_by { |i, _| i }.each do |_, route|
yield route

0 comments on commit eba8b70

Please sign in to comment.