Skip to content

Commit

Permalink
clang-format: don't align expressions after linebreaks
Browse files Browse the repository at this point in the history
We enforce alignment of expressions after linebreaks. Which means for
code such as

    return a || b;

it will expect:

   return a ||
          b;

we instead want 'b' to be indent with tabs, which is already done by the
'ContinuationIndentWidth' variable. So let's explicitly set
'AlignOperands' to false.

Signed-off-by: Karthik Nayak <[email protected]>
  • Loading branch information
KarthikNayak committed Oct 8, 2024
1 parent 34cd0c2 commit 3557012
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ AlignConsecutiveDeclarations: false
# int cccccccc;
AlignEscapedNewlines: Left

# Align operands of binary and ternary expressions
# int aaa = bbbbbbbbbbb +
# cccccc;
AlignOperands: true
# Don't enforce alignment after linebreaks and instead
# rely on the ContinuationIndentWidth value.
AlignOperands: false

# Don't align trailing comments
# int a; // Comment a
Expand Down

0 comments on commit 3557012

Please sign in to comment.