From 0f145c2315f794210160d2c65874aaf051c5911b Mon Sep 17 00:00:00 2001 From: Nick White Date: Fri, 25 Jan 2019 17:42:56 +0000 Subject: Simplify writing of sort functions in line pkg --- lib/line/line.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'lib/line') 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 -- cgit v1.2.1-24-ge1ad