dlang-community / dfmt

Dfmt is a formatter for D source code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

break in ternary operator that fits into a single line

belka-ew opened this issue · comments

./dfmt --keep_line_breaks=true test.d | diff -u100rN test.d -

class C
 {
     void f(
     {
         if (true)
         {
             if (true)
             {
                 if (true)
                 {
                     return f(abcdefghijklmnopqrs.uv,
                             abcdefghijklmnopqrs.uvwxyz, abcdefghijklmnopqrs.uv, abcdefghijklmnopqrs.uvwxyzwx,
                             abcdefghijklmnopqrs.uvwxyz,
-                            abcdefghijklmnopqrs.uvwxyzabcde ? Yes.yes: No.yes,
+                            abcdefghijklmnopqrs.uvwxyzabcde ? Yes.yes
+                            : No.yes,
                             abcdefghijklmnopqrs.uvwxy ? Yes.nooo : No.nooo);
                 }
             }
         }
     }
 }
--- src/prognosis/control/Manager.d
+++ dfmt src/prognosis/control/Manager.d
@@ -199,5 +199,6 @@
             VisitLink to = VisitLink(
-                linkScheduled.linkType == LinkType.continuation ? CONTINUE_TRAINID_BEGIN : TURN_BEGIN,
-                fetcher.get,
-                feeder.get.journeyId.trainId
+                linkScheduled.linkType == LinkType.continuation ? CONTINUE_TRAINID_BEGIN
+                    : TURN_BEGIN,
+                    fetcher.get,
+                    feeder.get.journeyId.trainId
             );

⚠️ Note the strange indenting of the lines after the questionable ?: line break.

(dfmt: 0.14.2)