Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix useless operator warnings #1660

Closed
wants to merge 1 commit into from
Closed

Commits on Jun 23, 2017

  1. Fix useless operator warnings

    `Forwardable._valid_method?` warns about useless operator when it is received an operator such as `*` and `+`.
    
    ```bash
    $ RUBYOPT='-w' ruby -rforwardable -e 'Forwardable._valid_method?(:*)'
    <compiled>: warning: possibly useless use of * in void context
    ```
    
    This behavior is problematic when a delegator is defined for an operator.
    For example:
    
    ```ruby
    require 'forwardable'
    
    class A
      extend Forwardable
    
      def s
        's'
      end
    
      def_delegator :s, :* # <compiled>: warning: possibly useless use of * in void context
    end
    
    p(A.new * 10) # => "ssssssssss"
    ```
    pocke committed Jun 23, 2017
    Configuration menu
    Copy the full SHA
    691b7a7 View commit details
    Browse the repository at this point in the history