Skip to content

Commit

Permalink
pkg/metricutil: change logical order to speedup
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf committed Feb 17, 2017
1 parent c21b12c commit ef745db
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/metricutil/metricutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ func convertCmdLabels() map[string]string {
}

func runesHasLowerNeighborAt(runes []rune, idx int) bool {

This comment has been minimized.

Copy link
@siddontang

siddontang Feb 17, 2017

Contributor

hasLowerNeighborAt

This comment has been minimized.

Copy link
@andelf

andelf Feb 17, 2017

Author Contributor

🤔 normal func, not a class/struct method, so prefixing by subject's type.

length := len(runes)

if idx+1 < length && unicode.IsLower(runes[idx+1]) {
if idx > 1 && unicode.IsLower(runes[idx-1]) {
return true
}
if idx > 1 && unicode.IsLower(runes[idx-1]) {
if idx+1 < len(runes) && unicode.IsLower(runes[idx+1]) {
return true
}
return false
Expand Down

0 comments on commit ef745db

Please sign in to comment.