clang-format: use rustfmt-like rules

This commit is contained in:
Ching Pei Yang 2025-01-03 04:31:20 +01:00
parent c5fe9c7164
commit 15602acda6
No known key found for this signature in database
GPG Key ID: B3841364253DC4C8

View File

@ -1,47 +1,60 @@
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -2 AccessModifierOffset: -2
AlignAfterOpenBracket: Align AlignAfterOpenBracket: BlockIndent # New in v14. For earlier clang-format versions, use AlwaysBreak instead.
AlignConsecutiveMacros: true AlignConsecutiveMacros: false
AlignConsecutiveAssignments: true AlignConsecutiveAssignments: false
AlignEscapedNewlines: Right AlignConsecutiveDeclarations: false
AlignEscapedNewlines: DontAlign
AlignOperands: false AlignOperands: false
AlignTrailingComments: true AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: true AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Attach BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon BreakConstructorInitializers: AfterColon
ColumnLimit: 180 BreakInheritanceList: AfterColon
BreakStringLiterals: false
ColumnLimit: 100
CompactNamespaces: false CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerAllOnOneLineOrOnePerLine: true
ExperimentalAutoDetectBinPacking: false ConstructorInitializerIndentWidth: 4
FixNamespaceComments: false ContinuationIndentWidth: 4
IncludeBlocks: Preserve Cpp11BracedListStyle: true
DerivePointerAlignment: false
FixNamespaceComments: true
IncludeBlocks: Regroup
IndentCaseLabels: true IndentCaseLabels: true
IndentPPDirectives: BeforeHash
IndentWidth: 4 IndentWidth: 4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
PointerAlignment: Left PointerAlignment: Left
ReferenceAlignment: Left # New in v13. int &name ==> int& name
ReflowComments: false ReflowComments: false
SortIncludes: false SeparateDefinitionBlocks: Always # New in v14.
SortUsingDeclarations: false SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true SpaceBeforeInheritanceColon: false
SpaceBeforeParens: ControlStatements SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false SpaceInEmptyParentheses: false
@ -51,15 +64,6 @@ SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false SpacesInContainerLiterals: false
SpacesInParentheses: false SpacesInParentheses: false
SpacesInSquareBrackets: false SpacesInSquareBrackets: false
Standard: Auto Standard: Cpp11
TabWidth: 4 TabWidth: 4
UseTab: Never UseTab: Never
AllowShortEnumsOnASingleLine: false
BraceWrapping:
AfterEnum: false
AlignConsecutiveDeclarations: AcrossEmptyLines
NamespaceIndentation: All