Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider formatting first-party C++ code with clang-format #103

Open
dtolnay opened this issue Oct 15, 2022 · 2 comments
Open

Consider formatting first-party C++ code with clang-format #103

dtolnay opened this issue Oct 15, 2022 · 2 comments
Milestone

Comments

@dtolnay
Copy link
Contributor

dtolnay commented Oct 15, 2022

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:

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: dd382f1

AlignAfterOpenBracket: Align
AlignOperands: DontAlign
AllowAllArgumentsOnNextLine: false
AllowShortFunctionsOnASingleLine: Empty
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
FixNamespaceComments: false
NamespaceIndentation: All
PointerAlignment: Left
ReferenceAlignment: Left
ReflowComments: false
@brson
Copy link
Owner

brson commented Oct 17, 2022

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.

@brson
Copy link
Owner

brson commented Oct 17, 2022

Add it to the existing cargo fmt ci job

@brson brson added this to the M3 milestone Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants