Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseduffield committed Mar 24, 2022
1 parent 340a145 commit 99e5572
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
6 changes: 2 additions & 4 deletions pkg/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,8 @@ func (app *App) KnownError(err error) (string, bool) {

knownErrorMessages := []string{app.Tr.MinGitVersionError}

if message, ok := slices.Find(knownErrorMessages, func(knownErrorMessage string) bool {
return knownErrorMessage == errorMessage
}); ok {
return message, true
if slices.Contains(knownErrorMessages, errorMessage) {
return errorMessage, true
}

mappings := []errorMapping{
Expand Down
14 changes: 6 additions & 8 deletions pkg/commands/git_commands/bisect_info.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package git_commands

import "github.com/sirupsen/logrus"
import (
"github.com/jesseduffield/generics/maps"
"github.com/jesseduffield/generics/slices"
"github.com/sirupsen/logrus"
)

// although the typical terms in a git bisect are 'bad' and 'good', they're more
// generally known as 'new' and 'old'. Semi-recently git allowed the user to define
Expand Down Expand Up @@ -93,11 +97,5 @@ func (self *BisectInfo) Bisecting() bool {
return false
}

for _, status := range self.statusMap {
if status == BisectStatusOld {
return true
}
}

return false
return slices.Contains(maps.Values(self.statusMap), BisectStatusOld)
}

0 comments on commit 99e5572

Please sign in to comment.