ifcond{//MATCH /if c { ... } can be rewritten if !c { return } ... to reduce nesting/
println()
println()
println()
}
}
funcfn2(){
for{
ifcond{//MATCH /if c { ... } can be rewritten if !c { continue } ... to reduce nesting/
println()
println()
println()
}
}
}
funcfn3(){
for{
// can't flip cond2 here because the cond1 branch would flow into it
ifcond1{
println()
}elseifcond2{
println()
println()
println()
}
}
}
funcfn4(){
for{
// cond1 branch continues here so this is ok
ifcond1{
println()
continue
}elseifcond2{//MATCH /if c { ... } can be rewritten if !c { continue } ... to reduce nesting/
println()
println()
println()
}
}
}
funcfn5(){
for{
// no point flipping cond here we only unnest one statement and need to introduce one new nested statement (continue) to do it
ifcond{
println()
}
}
}
funcfn6(){
for{
ifx,ok:=foo();ok{//MATCH /if c { ... } can be rewritten if !c { continue } ... to reduce nesting (move short variable declaration to its own line if necessary)/
println(x)
println(x)
println(x)
}
}
}
funcfn7(){
fori:=0;i<10;i++{
ifcond{//MATCH /if c { ... } can be rewritten if !c { continue } ... to reduce nesting/
println()
println()
println()
}
}
}
funcfn8(){
forrangec{
ifcond{//MATCH /if c { ... } can be rewritten if !c { continue } ... to reduce nesting/
println()
println()
println()
}
}
}
funcfn9(){
fn:=func(){
ifcond{//MATCH /if c { ... } can be rewritten if !c { return } ... to reduce nesting/
println()
println()
println()
}
}
fn()
}
funcfn10(){
switch{
casecond:
iffoo(){//MATCH /if c { ... } can be rewritten if !c { break } ... to reduce nesting/
println()
println()
println()
}
default:
ifbar(){//MATCH /if c { ... } can be rewritten if !c { break } ... to reduce nesting/
iferr:=a();err!=nil{//MATCH /if c { ... } can be rewritten if !c { return } ... to reduce nesting (move short variable declaration to its own line if necessary)/
println()
println()
log.Panic(err)
}
}
funcfn17(){
iferr:=a();err!=nil{//MATCH /if c { ... } can be rewritten if !c { return } ... to reduce nesting (move short variable declaration to its own line if necessary)/