From eba8b70d4ec7239694b026bef3c07e5ad82efe69 Mon Sep 17 00:00:00 2001 From: Viktar Basharymau Date: Thu, 22 May 2014 17:44:25 +0300 Subject: 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. --- actionpack/lib/action_dispatch/journey/formatter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/journey/formatter.rb b/actionpack/lib/action_dispatch/journey/formatter.rb index 7eaf8e49ce..4ed74225f7 100644 --- a/actionpack/lib/action_dispatch/journey/formatter.rb +++ b/actionpack/lib/action_dispatch/journey/formatter.rb @@ -85,7 +85,7 @@ module ActionDispatch 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 -- cgit v1.2.3