Skip to content

Commit cac45e3

Browse files
committed
Fix formatting issue
1 parent e8a6b40 commit cac45e3

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

src/dfmt/formatter.d

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,8 @@ private:
288288
case conditional_newline:
289289
immutable l = currentLineLength + betweenParenLength(tokens[index + 1 .. $]);
290290
if (l > config.dfmt_soft_max_line_length)
291-
{
292291
newline();
293-
}
294-
else
292+
else if (peekBackIs(tok!")"))
295293
write(" ");
296294
break;
297295
case always_newline:
@@ -304,7 +302,7 @@ private:
304302
pushWrapIndent(tok!"!");
305303
newline();
306304
}
307-
else
305+
else if (peekBackIs(tok!")"))
308306
write(" ");
309307
break;
310308
case always_newline_indent:
@@ -542,7 +540,7 @@ private:
542540
write(" ");
543541
}
544542
else if ((peekIsKeyword() || peekIs(tok!"@")) && spaceAfterParens
545-
&& !peekIs(tok!"in") && !peekIs(tok!"is"))
543+
&& !peekIs(tok!"in") && !peekIs(tok!"is") && !peekIs(tok!"if"))
546544
{
547545
writeToken();
548546
write(" ");

tests/allman/issue0153.d.ref

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
class Foo(T) : FirstInterfaceWithVeryLongName, SecondInterfaceWithVeryLongName if (is(T : Bar))
1+
class Foo(T) : FirstInterfaceWithVeryLongName, SecondInterfaceWithVeryLongName
2+
if (is(T : Bar))
23
{
34
void foo()
45
{

tests/allman/issue0215a.d.ref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ unittest
1010
bool anotherTemplatedFunction(One, Two, Three)(One alpha, Two bravo,
1111
Three charlie, double delta)
1212
if (isNumeric!One && isNumeric!Two && isNumeric!Three && echo
13-
&& foxtrot && golf && hotel && india && juliet)
13+
&& foxtrot && golf && hotel && india && juliet)
1414
{
1515

1616
}

tests/allman/issue0215d.d.ref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ unittest
1111
bool anotherTemplatedFunction(One, Two, Three)(One alpha, Two bravo,
1212
Three charlie, double delta)
1313
if (isNumeric!One && isNumeric!Two && isNumeric!Three && echo
14-
&& foxtrot && golf && hotel && india && juliet)
14+
&& foxtrot && golf && hotel && india && juliet)
1515
{
1616

1717
}

tests/otbs/issue0153.d.ref

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
class Foo(T) : FirstInterfaceWithVeryLongName, SecondInterfaceWithVeryLongName if (is(T : Bar)) {
1+
class Foo(T) : FirstInterfaceWithVeryLongName, SecondInterfaceWithVeryLongName
2+
if (is(T : Bar)) {
23
void foo() {
34
}
45
}

tests/otbs/issue0215a.d.ref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ unittest {
88
bool anotherTemplatedFunction(One, Two, Three)(One alpha, Two bravo,
99
Three charlie, double delta)
1010
if (isNumeric!One && isNumeric!Two && isNumeric!Three && echo
11-
&& foxtrot && golf && hotel && india && juliet) {
11+
&& foxtrot && golf && hotel && india && juliet) {
1212

1313
}
1414
}

tests/otbs/issue0215d.d.ref

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ unittest {
99
bool anotherTemplatedFunction(One, Two, Three)(One alpha, Two bravo,
1010
Three charlie, double delta)
1111
if (isNumeric!One && isNumeric!Two && isNumeric!Three && echo
12-
&& foxtrot && golf && hotel && india && juliet) {
12+
&& foxtrot && golf && hotel && india && juliet) {
1313

1414
}
1515
}

0 commit comments

Comments
 (0)