diff --git a/source/dub/commandline.d b/source/dub/commandline.d index f2b9b19..e7304de 100644 --- a/source/dub/commandline.d +++ b/source/dub/commandline.d @@ -430,13 +430,13 @@ { string msg = "Unknown build configuration: "~m_buildConfig; enum distance = 3; - if (auto match = dub.configurations.getClosestMatch(m_buildConfig, distance)) - msg ~= ". Did you mean '" ~ match ~ "'?"; + auto match = dub.configurations.getClosestMatch(m_buildConfig, distance); + if (match !is null) msg ~= ". Did you mean '" ~ match ~ "'?"; enforce(0, msg); } if (m_buildType.length == 0) { - if (environment.get("DFLAGS")) m_buildType = "$DFLAGS"; + if (environment.get("DFLAGS") !is null) m_buildType = "$DFLAGS"; else m_buildType = "debug"; } @@ -1563,13 +1563,13 @@ assert(names.length == 1 || names.length == 2); string sarg = names[0].length == 1 ? names[0] : null; string larg = names[0].length > 1 ? names[0] : names.length > 1 ? names[1] : null; - if (sarg) { + if (sarg !is null) { writeWS(shortArgColumn); writef("-%s", sarg); writeWS(longArgColumn - shortArgColumn - 2); } else writeWS(longArgColumn); size_t col = longArgColumn; - if (larg) { + if (larg !is null) { if (arg.defaultValue.peek!bool) { writef("--%s", larg); col += larg.length + 2; diff --git a/source/dub/dependencyresolver.d b/source/dub/dependencyresolver.d index 36804a0..6807295 100644 --- a/source/dub/dependencyresolver.d +++ b/source/dub/dependencyresolver.d @@ -175,7 +175,7 @@ visited = null; string error; auto conflict_index = validateConfigs(root, error); - if (!first_error) first_error = error; + if (first_error !is null) first_error = error; // print out current iteration state logDebug("Interation (ci=%s) %s", conflict_index, { diff --git a/source/dub/package_.d b/source/dub/package_.d index 0f3d895..795c417 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -561,7 +561,8 @@ return null; } - if (auto tag = exec("git", git_dir_param, "describe", "--long", "--tags")) { + auto tag = exec("git", git_dir_param, "describe", "--long", "--tags"); + if (tag !is null) { auto parts = tag.split("-"); auto commit = parts[$-1]; auto num = parts[$-2].to!int; @@ -573,7 +574,8 @@ } } - if (auto branch = exec("git", git_dir_param, "rev-parse", "--abbrev-ref", "HEAD")) { + auto branch = exec("git", git_dir_param, "rev-parse", "--abbrev-ref", "HEAD"); + if (branch !is null) { if (branch != "HEAD") return "~" ~ branch; } diff --git a/source/dub/project.d b/source/dub/project.d index 0d824c1..8a3b7d9 100644 --- a/source/dub/project.d +++ b/source/dub/project.d @@ -825,7 +825,8 @@ return prj.path.toNativeString(); } - if (auto envvar = environment.get(name)) return envvar; + auto envvar = environment.get(name) + if (envvar !is null) return envvar; throw new Exception("Invalid variable: "~name); } diff --git a/source/dub/recipe/json.d b/source/dub/recipe/json.d index ccf2a59..c7730c3 100644 --- a/source/dub/recipe/json.d +++ b/source/dub/recipe/json.d @@ -90,7 +90,7 @@ } ret.subPackages = jsonSubPackages; } - if (recipe.configurations) { + if (recipe.configurations.length) { Json[] configs; foreach(config; recipe.configurations) configs ~= config.toJson();