Remove redundant check and add a few more test cases

This commit is contained in:
Sijawusz Pur Rahnama 2021-02-04 22:24:29 +01:00
parent a9d1b17deb
commit 694c41650c
2 changed files with 4 additions and 1 deletions

View file

@ -8,8 +8,12 @@ module Ameba::Rule::Style
source = Source.new %( source = Source.new %(
(1..3).any?(&.odd?) (1..3).any?(&.odd?)
(1..3).join('.', &.to_s) (1..3).join('.', &.to_s)
(1..3).each_with_index { |i, idx| i * idx }
(1..3).map { |i| typeof(i) } (1..3).map { |i| typeof(i) }
(1..3).map { |i| i || 0 } (1..3).map { |i| i || 0 }
(1..3).map { |i| :foo }
(1..3).map { |i| :foo.to_s.split.join('.') }
(1..3).map { :foo }
) )
subject.catch(source).should be_valid subject.catch(source).should be_valid
end end

View file

@ -210,7 +210,6 @@ module Ameba::Rule::Style
while obj.is_a?(Crystal::Call) while obj.is_a?(Crystal::Call)
obj = obj.obj obj = obj.obj
end end
return unless obj.is_a?(Crystal::Var)
# only calls with a first argument used as a receiver are the valid game # only calls with a first argument used as a receiver are the valid game
return unless obj == arg return unless obj == arg