Skip to content

Instantly share code, notes, and snippets.

@DavidEGrayson
Last active December 23, 2017 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidEGrayson/9386c83394b3f9b9e7363d71d3958ed1 to your computer and use it in GitHub Desktop.
Save DavidEGrayson/9386c83394b3f9b9e7363d71d3958ed1 to your computer and use it in GitHub Desktop.
AllowShortBlocksOnASingleLine is not working with clang-format 5.0.0 on Manjaro Linux
$ clang-format --version
clang-format version 5.0.0 (tags/RELEASE_500/final)
$ cat .clang-format
AllowShortBlocksOnASingleLine: true
$ cat test.cpp
int foo(int x)
{
if (x == 0) { return 1; }
return 10 / x;
}
$ clang-format -style=file test.cpp
int foo(int x) {
if (x == 0) {
return 1;
}
return 10 / x;
}
# Expected behavior: clang-format should allow the one-line if statement, not turn it into 3 lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment