about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-01-26 12:03:21 +0100
committerDrew DeVault <sir@cmpwn.com>2020-01-28 10:36:00 -0500
commit2a3d120d6f138918ba8e62f04db78c327cb3ec18 (patch)
tree45c142a59af82fa3b75562cd6c8f7dda2c007a4c
parente78b7b85e4792f413175e13ef2fe437839b017a2 (diff)
downloadaerc-2a3d120d6f138918ba8e62f04db78c327cb3ec18.tar.gz
dirlist: remove not needed sort function
The docs of strings.Compare state:

> Compare is included only for symmetry with package bytes. It is usually
> clearer and always faster to use the built-in string comparison operators
> ==, <, >, and so on.

So let's do that.
-rw-r--r--widgets/dirlist.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index c0c8917..edc84c6 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -5,7 +5,6 @@ import (
 	"log"
 	"regexp"
 	"sort"
-	"strings"
 
 	"github.com/gdamore/tcell"
 	"github.com/mattn/go-runewidth"
@@ -316,7 +315,7 @@ func (dirlist *DirectoryList) sortDirsByFoldersSortConfig() {
 		if jInFoldersSort >= 0 {
 			return false
 		}
-		return strings.Compare(dirlist.dirs[i], dirlist.dirs[j]) == -1
+		return dirlist.dirs[i] < dirlist.dirs[j]
 	})
 }