[clang-format] How to make "short" if blocks one line? (original) (raw)
Greetings, I am using clang-format 14 with the following options set:
AllowShortBlocksOnASingleLine: Always
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
I am expecting the following code to be put into one line:
if (i == N) { a++; continue; }
Clang-format place them into four lines:
if (i == N) {
a++;
continue;
}
I noticed that if there was only one statement in the if-block, it would be placed in one line. Yet, I would consider the above if-block is short as well. Is there anything else I could set to achieve the expected format?
Sincerely.
JVApen May 23, 2024, 9:51am 2
As far as I’m aware, short implies that it contains 1 statement. As you have 2, it isn’t considered to put on 1 line.