diff mbox series

[v2,2/3] clang-format: don't align expressions after linebreaks

Message ID b55d5d2c14142fddad0b5bb84f41dd1c4eb6397a.1728582927.git.karthik.188@gmail.com (mailing list archive)
State Superseded
Headers show
Series clang-format: fix rules to make the CI job cleaner | expand

Commit Message

karthik nayak Oct. 10, 2024, 5:59 p.m. UTC
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 <karthik.188@gmail.com>
---
 .clang-format | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/.clang-format b/.clang-format
index 684ab32d28..d655b08ff6 100644
--- a/.clang-format
+++ b/.clang-format
@@ -42,10 +42,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