From 2a3d120d6f138918ba8e62f04db78c327cb3ec18 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Sun, 26 Jan 2020 12:03:21 +0100 Subject: 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. --- widgets/dirlist.go | 3 +-- 1 file changed, 1 insertion(+), 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] }) } -- cgit v1.2.3