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 authored and dlang-bot committed Dec 17, 2023
1 parent ade3fe6 commit 8025211
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 8025211

Please sign in to comment.