Skip to content

Commit

Permalink
Make Style/AutoResourceCleanup examples equivalent
Browse files Browse the repository at this point in the history
In the bad example, `f` is the `File` object, so in the good example it should be the same.
(Prior to this commit, `f` in the good example is the return value of the block passed to `File.open`.)
  • Loading branch information
duckinator authored and bbatsov committed Sep 11, 2017
1 parent e0fdb0b commit 04087f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rubocop/cop/style/auto_resource_cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Style
# f = File.open('file')
#
# # good
# f = File.open('file') do
# File.open('file') do |f|
# ...
# end
class AutoResourceCleanup < Cop
Expand Down
2 changes: 1 addition & 1 deletion manual/cops_style.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ resource cleanup.
f = File.open('file')

# good
f = File.open('file') do
File.open('file') do |f|
...
end
```
Expand Down

0 comments on commit 04087f9

Please sign in to comment.