mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Merge pull request #428 from crystal-ameba/revert-incorrect-excessive-allocations-condition
Revert "Fix `Performance/ExcessiveAllocations` to exclude `each` call…
This commit is contained in:
commit
9f9d5fae32
2 changed files with 1 additions and 2 deletions
|
@ -6,7 +6,6 @@ module Ameba::Rule::Performance
|
||||||
describe ExcessiveAllocations do
|
describe ExcessiveAllocations do
|
||||||
it "passes if there is no potential performance improvements" do
|
it "passes if there is no potential performance improvements" do
|
||||||
expect_no_issues subject, <<-CRYSTAL
|
expect_no_issues subject, <<-CRYSTAL
|
||||||
"Alice".chars.each
|
|
||||||
"Alice".chars.each(arg) { |c| puts c }
|
"Alice".chars.each(arg) { |c| puts c }
|
||||||
"Alice".chars(arg).each { |c| puts c }
|
"Alice".chars(arg).each { |c| puts c }
|
||||||
"Alice\nBob".lines.each(arg) { |l| puts l }
|
"Alice\nBob".lines.each(arg) { |l| puts l }
|
||||||
|
|
|
@ -52,7 +52,7 @@ module Ameba::Rule::Performance
|
||||||
end
|
end
|
||||||
|
|
||||||
def test(source, node : Crystal::Call)
|
def test(source, node : Crystal::Call)
|
||||||
return unless node.name == "each" && node.args.empty? && node.block
|
return unless node.name == "each" && node.args.empty?
|
||||||
return unless (obj = node.obj).is_a?(Crystal::Call)
|
return unless (obj = node.obj).is_a?(Crystal::Call)
|
||||||
return unless obj.args.empty? && obj.block.nil?
|
return unless obj.args.empty? && obj.block.nil?
|
||||||
return unless method = call_names[obj.name]?
|
return unless method = call_names[obj.name]?
|
||||||
|
|
Loading…
Reference in a new issue