mirror of
https://github.com/mgechev/revive.git
synced 2025-04-15 11:36:48 +02:00
speedup branch comparison (#764)
This commit is contained in:
parent
55e881a792
commit
06881a9f54
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user