AllowShortIfStatementsOnASingleLine
AllowShortIfStatementsOnASingleLine (ShortIfStyle)¶
Info
clang-format 9
如果为 true,则 if (a) return; 可以放在一条线上。
可能的值:
SIS_Never: 永远不要把简短的 if 放在同一行上。
if (a)
return;
if (b)
return;
else
return;
if (c)
return;
else {
return;
}
SIS_WithoutElse: 如果没有 else,只有当 else 不是复合语句时,才将短 if 放在同一行。
if (a) return;
if (b)
return;
else
return;
if (c)
return;
else {
return;
}
SIS_OnlyFirstIf: 在同一行中放置简短的 if,但不要放置 else if 或 else 语句。
if (a) return;
if (b) return;
else if (b)
return;
else
return;
if (c) return;
else {
return;
}
SIS_AllIfsAndElse: 如果 else 不是一个复合语句,总是将简短的 if 放在同一行。
if (a) return;
if (b) return;
else return;
if (c) return;
else {
return;
}
最后更新:
2022-10-31