Consider formatting first-party C++ code with clang-format
The 2 force-pushes in #102 are both because I screwed up formatting whitespace by hand. I have been spoiled by rustfmt long enough that I guess I am out of practice.
References:
- https://clang.llvm.org/docs/ClangFormat.html
- https://clang.llvm.org/docs/ClangFormatStyleOptions.html
I have been using clang-format in https://github.com/dtolnay/cxx and been happy with it.
The code style in shims.h is inconsistent (not to mention all the trailing whitespace) but the closest that I was able to get clang-format to match your dominant style is with the following config. Here is the resulting generated diff: https://github.com/brson/wasm-opt-rs/commit/dd382f1936252b94196afc8b701571eac6430646
AlignAfterOpenBracket: Align
AlignOperands: DontAlign
AllowAllArgumentsOnNextLine: false
AllowShortFunctionsOnASingleLine: Empty
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
FixNamespaceComments: false
NamespaceIndentation: All
PointerAlignment: Left
ReferenceAlignment: Left
ReflowComments: false
Sounds good to me. I'll probably reformat everything with the defaults. The only syntactic decision I care about is the redundant use of namespace blocks.
Add it to the existing cargo fmt ci job