mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Refactor Lint/UselessAssign
rule a bit
This commit is contained in:
parent
7f50ff90fd
commit
3bea264948
2 changed files with 24 additions and 11 deletions
|
@ -461,7 +461,7 @@ module Ameba::Rule::Lint
|
|||
expect_issue subject, <<-CRYSTAL
|
||||
class A
|
||||
foo : String? = "foo"
|
||||
# ^^^^^^^^^^^^^^^^^^^^^ error: Useless assignment to variable `foo`
|
||||
# ^^^ error: Useless assignment to variable `foo`
|
||||
|
||||
def method
|
||||
foo = "bar"
|
||||
|
@ -992,7 +992,7 @@ module Ameba::Rule::Lint
|
|||
it "reports if it's not referenced at a top level" do
|
||||
expect_issue subject, <<-CRYSTAL
|
||||
a : String?
|
||||
# ^^^^^^^^^ error: Useless assignment to variable `a`
|
||||
# ^{} error: Useless assignment to variable `a`
|
||||
CRYSTAL
|
||||
end
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ module Ameba::Rule::Lint
|
|||
expect_issue subject, <<-CRYSTAL
|
||||
def foo
|
||||
a : String?
|
||||
# ^^^^^^^^^^^ error: Useless assignment to variable `a`
|
||||
# ^ error: Useless assignment to variable `a`
|
||||
end
|
||||
CRYSTAL
|
||||
end
|
||||
|
@ -1009,7 +1009,7 @@ module Ameba::Rule::Lint
|
|||
expect_issue subject, <<-CRYSTAL
|
||||
class Foo
|
||||
a : String?
|
||||
# ^^^^^^^^^^^ error: Useless assignment to variable `a`
|
||||
# ^ error: Useless assignment to variable `a`
|
||||
end
|
||||
CRYSTAL
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue