Skip to content

Commit a42f0e2

Browse files
cuishuanggopherbot
authored andcommitted
all: use built-in max/min to simplify the code
Change-Id: Ic195ff4df3749050079c85739f61897279933268 Reviewed-on: https://go-review.googlesource.com/c/text/+/664816 Auto-Submit: Sean Liao <[email protected]> Reviewed-by: Sean Liao <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Mark Freeman <[email protected]>
1 parent e69f31b commit a42f0e2

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

secure/precis/enforce_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,6 @@ func TestTransformMallocs(t *testing.T) {
9292
}
9393
}
9494

95-
func min(a, b int) int {
96-
if a < b {
97-
return a
98-
}
99-
return b
100-
}
101-
10295
// TestTransformerShortBuffers tests that the precis.Transformer implements the
10396
// spirit, not just the letter (the method signatures), of the
10497
// transform.Transformer interface.

unicode/bidi/core.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,6 @@ type isolatingRunSequence struct {
427427

428428
func (i *isolatingRunSequence) Len() int { return len(i.indexes) }
429429

430-
func maxLevel(a, b level) level {
431-
if a > b {
432-
return a
433-
}
434-
return b
435-
}
436-
437430
// Rule X10, second bullet: Determine the start-of-sequence (sos) and end-of-sequence (eos) types,
438431
// either L or R, for each isolating run sequence.
439432
func (p *paragraph) isolatingRunSequence(indexes []int) *isolatingRunSequence {
@@ -474,8 +467,8 @@ func (p *paragraph) isolatingRunSequence(indexes []int) *isolatingRunSequence {
474467
indexes: indexes,
475468
types: types,
476469
level: level,
477-
sos: typeForLevel(maxLevel(prevLevel, level)),
478-
eos: typeForLevel(maxLevel(succLevel, level)),
470+
sos: typeForLevel(max(prevLevel, level)),
471+
eos: typeForLevel(max(succLevel, level)),
479472
}
480473
}
481474

0 commit comments

Comments
 (0)