Small optimizations and cleanups (#1830)
This commit is contained in:
1 parent
f5a0e655a1
commit
0f48f36b0f
6 files changed
+33
-31
No files matched your search
+4
-3
@@ -215,9 +215,9 @@ func matchExec(s string) (matches []string, longest []rune) {
|
||||
}
|
||||
}
|
||||
|
||||
sort.Strings(words)
|
||||
|
||||
if len(words) > 0 {
|
||||
sort.Strings(words)
|
||||
|
||||
uniq := words[:1]
|
||||
for i := 1; i < len(words); i++ {
|
||||
if words[i] != words[i-1] {
|
||||
@@ -294,7 +294,8 @@ func matchFile(s string) (matches []string, longest []rune) {
|
||||
}
|
||||
|
||||
func matchCmd(s string) (matches []string, longest []rune) {
|
||||
words := gCmdWords
|
||||
words := make([]string, 0, len(gCmdWords)+len(gOpts.cmds))
|
||||
words = append(words, gCmdWords...)
|
||||
for c := range gOpts.cmds {
|
||||
words = append(words, c)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user