Skip to content

Commit

Permalink
analyzer/testdata: use || in rules.go (#283)
Browse files Browse the repository at this point in the history
Fixes #273
Signed-off-by: Penthaa Patel <penthaapatel@gmail.com>
  • Loading branch information
penthaapatel authored Oct 15, 2021
1 parent 451d089 commit af7b672
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions analyzer/testdata/src/gocritic/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,8 @@ func testRules(m dsl.Matcher) {
Where(m["arr"].Type.Is(`*[$_]$_`)).
Report(`explicit array deref is redundant`)

// Can factor into a single rule when || operator
// is supported in filters.
m.Match(`$s[:]`).
Where(m["s"].Type.Is(`string`)).
Report(`can simplify $$ to $s`)
m.Match(`$s[:]`).
Where(m["s"].Type.Is(`[]$_`)).
Where(m["s"].Type.Is(`string`) || m["s"].Type.Is(`[]$_`)).
Report(`can simplify $$ to $s`)

m.Match(`switch $_ {case $_: $*_}`,
Expand Down

0 comments on commit af7b672

Please sign in to comment.