8

これが欲しい:

if (!enabled)
{
    return;
}

これに変わりました:

if (!enabled) { return; }

(つまり、短い if 文を 1 行にまとめたいのですが、{}前後はそのままにしておきます)

現在、次の構成を使用しています。

AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortBlocksOnASingleLine: true
BreakBeforeBraces: Allman

ただし、私が得ている出力は次のとおりです。

if (!enabled) 
{
    return;
}

上記のフォーマットはclang-formatで実現できますか?

4

1 に答える 1