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