From bf6b65432ba3d2765c1fcea90d9969eb87f49625 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Wed, 16 Mar 2016 08:33:31 +0100 Subject: [PATCH] no need to clear an unusued collection If the code reaches that line new_constants is no longer needed. We only need here to iterate over it to discard stuff and done. Note that constant_watch_stack.new_constants returns a new reference each time it is invoked, so that #clear call was not cleaning state in some internal structure (which would have been a bit dirty as well at this level of coupling). --- activesupport/lib/active_support/dependencies.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 7c681092fa..fc0a358645 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -666,7 +666,7 @@ module ActiveSupport #:nodoc: return new_constants unless aborting - new_constants.each { |c| remove_constant(c) }.clear + new_constants.each { |c| remove_constant(c) } end end