mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Use #in?
instead of #includes?
in several places
Because: 1. it’s more semantically descriptive 2. it’s shorter
This commit is contained in:
parent
ed6085e6a6
commit
d1bfdaabeb
3 changed files with 3 additions and 3 deletions
|
@ -85,7 +85,7 @@ module Ameba::AST
|
||||||
consumed_branches = Set(Branch).new
|
consumed_branches = Set(Branch).new
|
||||||
|
|
||||||
assignments.reverse_each do |assignment|
|
assignments.reverse_each do |assignment|
|
||||||
next if consumed_branches.includes?(assignment.branch)
|
next if assignment.branch.in?(consumed_branches)
|
||||||
assignment.referenced = true
|
assignment.referenced = true
|
||||||
|
|
||||||
break unless branch = assignment.branch
|
break unless branch = assignment.branch
|
||||||
|
|
|
@ -23,7 +23,7 @@ module Ameba::Rule::Lint
|
||||||
def test(source)
|
def test(source)
|
||||||
nodes = AST::TopLevelNodesVisitor.new(source.ast).require_nodes
|
nodes = AST::TopLevelNodesVisitor.new(source.ast).require_nodes
|
||||||
nodes.each_with_object([] of String) do |node, processed_require_strings|
|
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
|
processed_require_strings << node.string
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,7 +55,7 @@ module Ameba::Rule::Style
|
||||||
private getter var_locations = [] of Crystal::Location
|
private getter var_locations = [] of Crystal::Location
|
||||||
|
|
||||||
def visit(node : Crystal::Var)
|
def visit(node : Crystal::Var)
|
||||||
!var_locations.includes?(node.location) && super
|
!node.location.in?(var_locations) && super
|
||||||
end
|
end
|
||||||
|
|
||||||
def visit(node : Crystal::InstanceVar | Crystal::ClassVar)
|
def visit(node : Crystal::InstanceVar | Crystal::ClassVar)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue