Skip to content

Commit

Permalink
cue/errors: remove redundant Sort call in list.sanitize
Browse files Browse the repository at this point in the history
While looking at error handling code, I noticed that error list is being
sorted twice when searching for duplicates: once in sanitize,
and again in RemoveMultiples immediately after. One Sort call is enough.

Closes #2233 as merged as of commit 92b901a.

Signed-off-by: Anton Rychkov <zeithaste@gmail.com>
Change-Id: I18f8a02651e792131022e38fd870792d6bdaa33f
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/552133
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
  • Loading branch information
zeithaste authored and mvdan committed Apr 3, 2023
1 parent d71a76c commit f106acf
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion cue/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ func (p list) sanitize() list {
}
a := make(list, len(p))
copy(a, p)
a.Sort()
a.RemoveMultiples()
return a
}
Expand Down

0 comments on commit f106acf

Please sign in to comment.