diff --git a/src/nimble.nim b/src/nimble.nim index fc2a3a0..f0d8878 100644 --- a/src/nimble.nim +++ b/src/nimble.nim @@ -622,7 +622,6 @@ proc listPaths(options: Options) = ## On success the proc returns normally. cli.setSuppressMessages(true) assert options.action.typ == actionPath - assert(not options.action.packages.isNil) if options.action.packages.len == 0: raise newException(NimbleError, "A package name needs to be specified") diff --git a/src/nimblepkg/download.nim b/src/nimblepkg/download.nim index cad8d3d..226fe27 100644 --- a/src/nimblepkg/download.nim +++ b/src/nimblepkg/download.nim @@ -166,9 +166,6 @@ proc doDownload(url: string, downloadDir: string, verRange: VersionRange, meth if $latest.ver != "": result = latest.ver - else: - # Result should already be set to #head here. - assert(not result.isNil) removeDir(downloadDir) if verRange.kind == verSpecial: diff --git a/src/nimblepkg/nimscriptsupport.nim b/src/nimblepkg/nimscriptsupport.nim index 91ab7ff..0de2010 100644 --- a/src/nimblepkg/nimscriptsupport.nim +++ b/src/nimblepkg/nimscriptsupport.nim @@ -51,7 +51,7 @@ proc getGlobal(g: ModuleGraph; ident: PSym): string = else: let n = vm.globalCtx.getGlobalValue(ident) if n.isStrLit: - result = if n.strVal.isNil: "" else: n.strVal + result = n.strVal else: raiseVariableError(ident.name.s, "string") diff --git a/src/nimblepkg/packageinfo.nim b/src/nimblepkg/packageinfo.nim index e6e3726..6306840 100644 --- a/src/nimblepkg/packageinfo.nim +++ b/src/nimblepkg/packageinfo.nim @@ -371,8 +371,7 @@ proc findPkg*(pkglist: seq[tuple[pkgInfo: PackageInfo, meta: MetaData]], if cmpIgnoreStyle(pkg.pkginfo.name, dep.name) != 0 and cmpIgnoreStyle(pkg.meta.url, dep.name) != 0: continue if withinRange(pkg.pkgInfo, dep.ver): - let isNewer = (not r.version.isNil) and - newVersion(r.version) < newVersion(pkg.pkginfo.version) + let isNewer = newVersion(r.version) < newVersion(pkg.pkginfo.version) if not result or isNewer: r = pkg.pkginfo result = true diff --git a/src/nimblepkg/packageinstaller.nim b/src/nimblepkg/packageinstaller.nim index e48a910..125db93 100644 --- a/src/nimblepkg/packageinstaller.nim +++ b/src/nimblepkg/packageinstaller.nim @@ -81,7 +81,7 @@ proc saveNimbleMeta*(pkgDestDir, url, vcsRevision: string, ## ## isLink - Determines whether the installed package is a .nimble-link. var nimblemeta = %{"url": %url} - if not vcsRevision.isNil: + if vcsRevision.len > 0: nimblemeta["vcsRevision"] = %vcsRevision let files = newJArray() nimblemeta["files"] = files diff --git a/src/nimblepkg/version.nim b/src/nimblepkg/version.nim index e19e45b..6b1e7df 100644 --- a/src/nimblepkg/version.nim +++ b/src/nimblepkg/version.nim @@ -39,8 +39,6 @@ proc `$`*(ver: Version): string {.borrow.} proc hash*(ver: Version): Hash {.borrow.} -proc isNil*(ver: Version): bool {.borrow.} - proc newVersion*(ver: string): Version = doAssert(ver.len == 0 or ver[0] in {'#', '\0'} + Digits, "Wrong version: " & ver)