From 15602acda6eafee8b0a9c7d4e830c3533261985c Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Fri, 3 Jan 2025 04:31:20 +0100 Subject: [PATCH] clang-format: use rustfmt-like rules --- .clang-format | 76 +++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/.clang-format b/.clang-format index 90314ef..f647de6 100644 --- a/.clang-format +++ b/.clang-format @@ -1,47 +1,60 @@ ---- -Language: Cpp -BasedOnStyle: LLVM - AccessModifierOffset: -2 -AlignAfterOpenBracket: Align -AlignConsecutiveMacros: true -AlignConsecutiveAssignments: true -AlignEscapedNewlines: Right +AlignAfterOpenBracket: BlockIndent # New in v14. For earlier clang-format versions, use AlwaysBreak instead. +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: DontAlign AlignOperands: false -AlignTrailingComments: true -AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: true -AllowShortCaseLabelsOnASingleLine: true +AlignTrailingComments: false +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Empty +AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: Empty AllowShortIfStatementsOnASingleLine: Never AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +BreakBeforeBinaryOperators: NonAssignment BreakBeforeBraces: Attach -BreakBeforeTernaryOperators: false +BreakBeforeTernaryOperators: true BreakConstructorInitializers: AfterColon -ColumnLimit: 180 +BreakInheritanceList: AfterColon +BreakStringLiterals: false +ColumnLimit: 100 CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: false -IncludeBlocks: Preserve +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +FixNamespaceComments: true +IncludeBlocks: Regroup IndentCaseLabels: true +IndentPPDirectives: BeforeHash IndentWidth: 4 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: Inner PointerAlignment: Left +ReferenceAlignment: Left # New in v13. int &name ==> int& name ReflowComments: false -SortIncludes: false -SortUsingDeclarations: false +SeparateDefinitionBlocks: Always # New in v14. +SortIncludes: true +SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: true SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true +SpaceBeforeInheritanceColon: false SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyParentheses: false @@ -51,15 +64,6 @@ SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false -Standard: Auto +Standard: Cpp11 TabWidth: 4 UseTab: Never - -AllowShortEnumsOnASingleLine: false - -BraceWrapping: - AfterEnum: false - -AlignConsecutiveDeclarations: AcrossEmptyLines - -NamespaceIndentation: All