mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
show warning for unused block
With verbopse mode (-w), the interpreter shows a warning if
a block is passed to a method which does not use the given block.
Warning on:
* the invoked method is written in C
* the invoked method is not `initialize`
* not invoked with `super`
* the first time on the call-site with the invoked method
(`obj.foo{}` will be warned once if `foo` is same method)
[Feature #15554]
`Primitive.attr! :use_block` is introduced to declare that primitive
functions (written in C) will use passed block.
For minitest, test needs some tweak, so use
ea9caafc07
for `test-bundled-gems`.
This commit is contained in:
parent
515e52a0b1
commit
9180e33ca3
18 changed files with 165 additions and 13 deletions
1
dir.rb
1
dir.rb
|
@ -408,6 +408,7 @@ class Dir
|
|||
# specifies that patterns may match short names if they exist; Windows only.
|
||||
#
|
||||
def self.glob(pattern, _flags = 0, flags: _flags, base: nil, sort: true)
|
||||
Primitive.attr! :use_block
|
||||
Primitive.dir_s_glob(pattern, flags, base, sort)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue