Use #in? instead of #includes? in several places

Because:

1. it’s more semantically descriptive
2. it’s shorter
This commit is contained in:
Sijawusz Pur Rahnama 2022-11-14 01:13:54 +01:00
parent ed6085e6a6
commit d1bfdaabeb
3 changed files with 3 additions and 3 deletions

View file

@ -85,7 +85,7 @@ module Ameba::AST
consumed_branches = Set(Branch).new
assignments.reverse_each do |assignment|
next if consumed_branches.includes?(assignment.branch)
next if assignment.branch.in?(consumed_branches)
assignment.referenced = true
break unless branch = assignment.branch

View file

@ -23,7 +23,7 @@ module Ameba::Rule::Lint
def test(source)
nodes = AST::TopLevelNodesVisitor.new(source.ast).require_nodes
nodes.each_with_object([] of String) do |node, processed_require_strings|
issue_for(node, MSG % node.string) if processed_require_strings.includes?(node.string)
issue_for(node, MSG % node.string) if node.string.in?(processed_require_strings)
processed_require_strings << node.string
end
end

View file

@ -55,7 +55,7 @@ module Ameba::Rule::Style
private getter var_locations = [] of Crystal::Location
def visit(node : Crystal::Var)
!var_locations.includes?(node.location) && super
!node.location.in?(var_locations) && super
end
def visit(node : Crystal::InstanceVar | Crystal::ClassVar)