mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
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.
This commit is contained in:
parent
8c3091edc1
commit
c9610fbf57
1 changed files with 2 additions and 4 deletions
|
|
@ -35,8 +35,7 @@ func (r Range[T]) First() T {
|
||||||
return r.first
|
return r.first
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last returns the last element of the range. The function panics if the range
|
// Last returns the last element of the range. This panics for empty ranges.
|
||||||
// is empty.
|
|
||||||
func (r Range[T]) Last() T {
|
func (r Range[T]) Last() T {
|
||||||
if r.first == r.afterLast {
|
if r.first == r.afterLast {
|
||||||
panic("last item of zero length range is not allowed")
|
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
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
// Union returns the union of two ranges. The function panics if there is a gap
|
// Union returns the union of two ranges. Panics for gapped ranges.
|
||||||
// between the ranges.
|
|
||||||
func (r Range[T]) Union(q Range[T]) Range[T] {
|
func (r Range[T]) Union(q Range[T]) Range[T] {
|
||||||
if max(r.first, q.first) > min(r.afterLast, q.afterLast) {
|
if max(r.first, q.first) > min(r.afterLast, q.afterLast) {
|
||||||
panic("cannot create union; gap between ranges")
|
panic("cannot create union; gap between ranges")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue