From 97208fa16dd92dfa3284e3a77f16ba638fa0249b Mon Sep 17 00:00:00 2001 From: Mathias Lang Date: Sun, 17 Dec 2023 22:30:51 +0100 Subject: [PATCH] Trivial: Simplify checkDubRequirements Remove a redundant import and streamline control flow. --- source/dub/package_.d | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/source/dub/package_.d b/source/dub/package_.d index 27f696d3f..5ff284348 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -669,7 +669,6 @@ class Package { private void checkDubRequirements() { - import dub.dependency : Dependency; import dub.semver : isValidVersion; import dub.version_ : dubVersion; import std.exception : enforce; @@ -677,12 +676,7 @@ class Package { const dep = m_info.toolchainRequirements.dub; static assert(dubVersion.length); - static if (dubVersion[0] == 'v') { - enum dv = dubVersion[1 .. $]; - } - else { - enum dv = dubVersion; - } + immutable dv = dubVersion[(dubVersion[0] == 'v') .. $]; static assert(isValidVersion(dv)); enforce(dep.matches(dv),