Skip to content

Commit

Permalink
no need to clear an unusued collection
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
fxn committed Mar 16, 2016
1 parent 4b80395 commit bf6b654
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activesupport/lib/active_support/dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ def new_constants_in(*descs)

return new_constants unless aborting

new_constants.each { |c| remove_constant(c) }.clear
new_constants.each { |c| remove_constant(c) }
end
end

Expand Down

0 comments on commit bf6b654

Please sign in to comment.