1
0
mirror of https://github.com/mgechev/revive.git synced 2025-07-03 00:26:51 +02:00

speedup branch comparison (#764)

This commit is contained in:
chavacava
2022-10-24 17:21:48 +02:00
committed by GitHub
parent 55e881a792
commit 06881a9f54

View File

@ -63,8 +63,10 @@ func (lintIdenticalBranches) identicalBranches(branches []*ast.BlockStmt) bool {
} }
ref := gofmt(branches[0]) ref := gofmt(branches[0])
refSize := len(branches[0].List)
for i := 1; i < len(branches); i++ { for i := 1; i < len(branches); i++ {
if gofmt(branches[i]) != ref { currentSize := len(branches[i].List)
if currentSize != refSize || gofmt(branches[i]) != ref {
return false return false
} }
} }