From abc3e6d47e377839ae180a0a9597bbc7c61bd3a7 Mon Sep 17 00:00:00 2001 From: Kotet Date: Mon, 27 Nov 2017 07:32:05 +0900 Subject: [PATCH] Use std.algorithm.comparison.among instead of a lot of comparisons --- src/dfmt/indentation.d | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dfmt/indentation.d b/src/dfmt/indentation.d index 01c14bd..f065945 100644 --- a/src/dfmt/indentation.d +++ b/src/dfmt/indentation.d @@ -176,6 +176,7 @@ private: int indentSize(const size_t k = size_t.max) const pure nothrow @safe @nogc { + import std.algorithm : among; if (index == 0 || k == 0) return 0; immutable size_t j = k == size_t.max ? index : k; @@ -196,9 +197,9 @@ private: continue; immutable currentIsNonWrapTemp = !isWrapIndent(arr[i]) && isTempIndent(arr[i]) && arr[i] != tok!")" && arr[i] != tok!"!"; - if (arr[i] == tok!"static" && (arr[i + 1] == tok!"if" - || arr[i + 1] == tok!"else" || arr[i + 1] == tok!"foreach" - || arr[i + 1] == tok!"foreach_reverse") && (i + 2 >= index || arr[i + 2] != tok!"{")) + if (arr[i] == tok!"static" + && arr[i + 1].among!(tok!"if", tok!"else", tok!"foreach", tok!"foreach_reverse") + && (i + 2 >= index || arr[i + 2] != tok!"{")) { parenCount = pc; continue;