Skip to content

Commit

Permalink
code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
testwill authored and yashtewari committed Jun 22, 2023
1 parent a5e8a77 commit 9f24ebf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
6 changes: 1 addition & 5 deletions glob.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,7 @@ func NewDot() Token {
}

func (d dot) Equal(other Token) bool {
if d.Type() != other.Type() {
return false
}

return true
return d.Type() == other.Type()
}

func (d dot) String() string {
Expand Down
8 changes: 2 additions & 6 deletions non_empty.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ func intersectStar(starred, other Glob) bool {
}

// If there was no token following starToken, and everything from other was gobbled, the Globs intersect.
if nextToken == nil {
return true
}

// If everything from other was gobbles but there was a nextToken to match, they don't intersect.
return false
//If everything from other was gobbles but there was a nextToken to match, they don't intersect.
return nextToken == nil
}
4 changes: 2 additions & 2 deletions non_empty_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ func BenchmarkInterspersedStarsEmptyEnd(b *testing.B) {
// smallLimit specifies the maximum star count of the smaller of two inputs.
// largeLimit specifies the maximum star count of the larger of two inputs.
smallLimit, largeLimit := 10, 50
inputL := make([]string, largeLimit+1, largeLimit+1)
inputR := make([]string, largeLimit+1, largeLimit+1)
inputL := make([]string, largeLimit+1)
inputR := make([]string, largeLimit+1)

for i := 1; i <= largeLimit; i++ {
inputL[i], inputR[i] = interspersedStars(i - 1)
Expand Down

0 comments on commit 9f24ebf

Please sign in to comment.