blob: 35c774bffe3ac5f7333d7855cce8251dd3db1666 [file] [log] [blame]
40 columns |
>>> keep case and guard on same line if possible
if (obj case constant when condition) {;}
<<<
if (obj case constant when condition) {
;
}
>>> prefer to split guard before case
if (expression case longConstant when condition) {;}
<<<
if (expression case longConstant
when condition) {
;
}
>>> can split case and keep guard on same line
if (veryLongExpression case veryLongConstant when cond) {;}
<<<
if (veryLongExpression
case veryLongConstant when cond) {
;
}
>>> split case and guard
if (veryLongExpression case veryLongConstant when veryLongCondition) {;}
<<<
if (veryLongExpression
case veryLongConstant
when veryLongCondition) {
;
}
>>> if value expression block splits then case splits
if (veryLongExpression + anotherVeryLongOne case someCase) {;}
<<<
if (veryLongExpression +
anotherVeryLongOne
case someCase) {
;
}
>>> if value expression block splits then case splits but guard doesn't have to
if (veryLongExpression + anotherVeryLongOne case someCase when true) {;}
<<<
if (veryLongExpression +
anotherVeryLongOne
case someCase when true) {
;
}
>>> if pattern block splits then case splits
if (obj case const [element,]) {;}
<<<
if (obj
case const [
element,
]) {
;
}
>>> if guard condition block splits then guard splits
if (obj case constant when [element,]) {;}
<<<
if (obj case constant
when [
element,
]) {
;
}
>>> block splits in both pattern and guard
if (obj case const [element,] when [element,]) {;}
<<<
if (obj
case const [
element,
]
when [
element,
]) {
;
}
>>> if pattern splits then case splits
if (obj case veryLongConstant || longConstant) {;}
<<<
if (obj
case veryLongConstant ||
longConstant) {
;
}
>>> if guard condition block splits then guard splits
if (obj case constant when veryLongExpression + anotherOne) {;}
<<<
if (obj case constant
when veryLongExpression +
anotherOne) {
;
}