Fix: Use more readable expression

This commit is contained in:
sobaya 2019-08-04 13:04:39 +09:00
parent b3946b7525
commit ac8e34815f
1 changed files with 5 additions and 5 deletions

View File

@ -725,7 +725,7 @@ private:
void formatColon()
{
import dfmt.editorconfig : OptionalBoolean;
import std.algorithm : canFind;
import std.algorithm : canFind, any;
immutable bool isCase = astInformation.caseEndLocations.canFindIndex(current.index);
immutable bool isAttribute = astInformation.attributeDeclarationLines.canFindIndex(
@ -747,10 +747,10 @@ private:
newline();
}
}
else if (peekBackIs(tok!"identifier") && (peekBack2Is(tok!"{", true)
|| peekBack2Is(tok!"}", true) || peekBack2Is(tok!";", true)
|| peekBack2Is(tok!":", true) || peekBack2Is(tok!",", true))
&& !(isBlockHeader(1) && !peekIs(tok!"if")))
else if (peekBackIs(tok!"identifier")
&& [tok!"{", tok!"}", tok!";", tok!":", tok!","]
.any!((ptrdiff_t token) => peekBack2Is(cast(IdType)token, true))
&& (!isBlockHeader(1) || peekIs(tok!"if")))
{
writeToken();
if (isStructInitializer)