Skip to content

Commit 04087f9

Browse files
duckinatorbbatsov
authored andcommitted
Make Style/AutoResourceCleanup examples equivalent
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`.)
1 parent e0fdb0b commit 04087f9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rubocop/cop/style/auto_resource_cleanup.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Style
1313
# f = File.open('file')
1414
#
1515
# # good
16-
# f = File.open('file') do
16+
# File.open('file') do |f|
1717
# ...
1818
# end
1919
class AutoResourceCleanup < Cop

manual/cops_style.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ resource cleanup.
147147
f = File.open('file')
148148

149149
# good
150-
f = File.open('file') do
150+
File.open('file') do |f|
151151
...
152152
end
153153
```

0 commit comments

Comments
 (0)