From c9610fbf57ffbec40c4ff30ad6917adbdeb924ed Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 17 Mar 2025 15:32:13 +0100 Subject: [PATCH] common: shorten some comments It's important to show the panic cases on the first doc line. Makes it easier to notice in grep, etc. --- common/range.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/range.go b/common/range.go index d6b4eaba53..c3a26ea7f5 100644 --- a/common/range.go +++ b/common/range.go @@ -35,8 +35,7 @@ func (r Range[T]) First() T { return r.first } -// Last returns the last element of the range. The function panics if the range -// is empty. +// Last returns the last element of the range. This panics for empty ranges. func (r Range[T]) Last() T { if r.first == r.afterLast { panic("last item of zero length range is not allowed") @@ -96,8 +95,7 @@ func (r Range[T]) Intersection(q Range[T]) Range[T] { return i } -// Union returns the union of two ranges. The function panics if there is a gap -// between the ranges. +// Union returns the union of two ranges. Panics for gapped ranges. func (r Range[T]) Union(q Range[T]) Range[T] { if max(r.first, q.first) > min(r.afterLast, q.afterLast) { panic("cannot create union; gap between ranges")