1
0
mirror of https://github.com/mgechev/revive.git synced 2025-11-23 22:04:49 +02:00
Files
revive/testdata/useless_fallthrough.go
2025-10-24 09:35:19 -07:00

79 lines
1.4 KiB
Go

package fixtures
func uselessFallthrough() {
switch a {
case 0:
println()
fallthrough
default:
}
switch a {
case 0:
fallthrough // MATCH /this "fallthrough" can be removed by consolidating this case clause with the next one/
case 1:
println()
default:
}
switch a {
case 0:
fallthrough // MATCH /this "fallthrough" can be removed by consolidating this case clause with the next one/
case 1:
fallthrough // MATCH /this "fallthrough" can be removed by consolidating this case clause with the next one/
case 2:
println()
default:
}
switch a {
case 0:
fallthrough
default:
println()
}
switch a {
case 0:
fallthrough
default:
println()
case 1:
fallthrough // MATCH /this "fallthrough" can be removed by consolidating this case clause with the next one/
case 2:
println()
}
switch a {
case 0:
fallthrough
default:
println()
}
switch goos {
case "linux":
// TODO(bradfitz): be fancy and use linkat with AT_EMPTY_PATH to avoid
// copying? I couldn't get it to work, though.
// For now, just do the same thing as every other Unix and copy
// the binary.
fallthrough // json:{"MATCH": "this \"fallthrough\" can be removed by consolidating this case clause with the next one","Confidence": 0.5}
case "darwin", "freebsd", "openbsd", "netbsd":
return
case "windows":
return
default:
return
}
switch a {
case 0:
//foo:bar
fallthrough
default:
println()
}
}