dfmt icon indicating copy to clipboard operation
dfmt copied to clipboard

break in ternary operator that fits into a single line

Open belka-ew opened this issue 4 years ago • 1 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);
                 }
             }
         }
     }
 }

belka-ew avatar Nov 30 '20 15:11 belka-ew

--- 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)

MWumpusZ avatar Oct 10 '22 13:10 MWumpusZ