Skip to content

Commit

Permalink
Trivial: Simplify checkDubRequirements
Browse files Browse the repository at this point in the history
Remove a redundant import and streamline control flow.
  • Loading branch information
Geod24 committed Dec 17, 2023
1 parent afaf10a commit 97208fa
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions source/dub/package_.d
Original file line number Diff line number Diff line change
Expand Up @@ -669,20 +669,14 @@ class Package {

private void checkDubRequirements()
{
import dub.dependency : Dependency;
import dub.semver : isValidVersion;
import dub.version_ : dubVersion;
import std.exception : enforce;

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),
Expand Down

0 comments on commit 97208fa

Please sign in to comment.