summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-01-25 17:42:56 +0000
committerNick White <git@njw.name>2019-01-25 17:42:56 +0000
commit0f145c2315f794210160d2c65874aaf051c5911b (patch)
tree6188576ce58bc1a0282bcb95b4e46829d1d37dd1
parent988658936cbcd8e92b35a66e1943bea0f9eaf3bc (diff)
Simplify writing of sort functions in line pkg
-rw-r--r--lib/line/line.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/line/line.go b/lib/line/line.go
index 656fbce..d4e3e44 100644
--- a/lib/line/line.go
+++ b/lib/line/line.go
@@ -21,16 +21,9 @@ type CopyableImg interface {
type Details []Detail
-// Used by sort.Sort.
-func (l Details) Len() int { return len(l) }
-
-// Used by sort.Sort.
-func (l Details) Less(i, j int) bool {
- return l[i].Avgconf < l[j].Avgconf
-}
-
-// Used by sort.Sort.
-func (l Details) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
+func (l Details) Len() int { return len(l) }
+func (l Details) Less(i, j int) bool { return l[i].Avgconf < l[j].Avgconf }
+func (l Details) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
// This is an implementation of the CopyableImg interface that
// stores the image directly as an image.Image