// linebreaks. At the moment there is no easy way to know about
// future (not yet interspersed) comments in this function.
func (p *printer) linebreak(line, min int, ws whiteSpace, newSection bool) (nbreaks int) {
- n := nlimit(line - p.pos.Line)
- if n < min {
- n = min
- }
+ n := max(nlimit(line-p.pos.Line), min)
if n > 0 {
p.print(ws)
if newSection {
h4, h5, mp := walkBinary(l)
has4 = has4 || h4
has5 = has5 || h5
- if maxProblem < mp {
- maxProblem = mp
- }
+ maxProblem = max(maxProblem, mp)
}
switch r := e.Y.(type) {
h4, h5, mp := walkBinary(r)
has4 = has4 || h4
has5 = has5 || h5
- if maxProblem < mp {
- maxProblem = mp
- }
+ maxProblem = max(maxProblem, mp)
case *ast.StarExpr:
if e.Op == token.QUO { // `*/`
case "/*", "&&", "&^":
maxProblem = 5
case "++", "--":
- if maxProblem < 4 {
- maxProblem = 4
- }
+ maxProblem = max(maxProblem, 4)
}
}
return
// nlimit limits n to maxNewlines.
func nlimit(n int) int {
- if n > maxNewlines {
- n = maxNewlines
- }
- return n
+ return min(n, maxNewlines)
}
func mayCombine(prev token.Token, next byte) (b bool) {