Skip to content

Commit

Permalink
simplify getMapKeysSortCmp for boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrre committed Aug 5, 2024
1 parent 5dae340 commit a7d1cc6
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pretty.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,12 +424,7 @@ func (c *Config) getMapKeysSortCmp(typ reflect.Type) func(a, b reflect.Value) in
switch typ.Kind() { //nolint:exhaustive // Optimized for common kinds, the default case is less optimized.
case reflect.Bool:
return func(a, b reflect.Value) int {
ab := a.Bool()
bb := b.Bool()
if ab == bb {
return 0
}
if !ab {
if !a.Bool() {
return -1
}
return 1
Expand Down

0 comments on commit a7d1cc6

Please sign in to comment.