Skip to content

Commit 5d432bb

Browse files
committed
Revert "remove unnecessary dup"
This reverts commit 2807e3c.
1 parent 50ef9af commit 5d432bb

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/nimble.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ proc validateDevModeDepsWorkingCopiesBeforeLock(
14801480
}
14811481

14821482
# Remove not errors from the errors set.
1483-
for name, error in errors:
1483+
for name, error in common.dup(errors):
14841484
if error.kind in notAnErrorSet:
14851485
errors.del name
14861486

@@ -1699,7 +1699,7 @@ proc sync(options: Options) =
16991699
var errors: ValidationErrors
17001700
findValidationErrorsOfDevDepsWithLockFile(pkgInfo, options, errors)
17011701

1702-
for name, error in errors:
1702+
for name, error in common.dup(errors):
17031703
if error.kind == vekWorkingCopyNeedsSync:
17041704
if not options.action.listOnly:
17051705
syncWorkingCopy(name, error.path, pkgInfo, options)

src/nimblepkg/common.nim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ template newClone*[T: not ref](obj: T): ref T =
5252
result[] = obj
5353
result
5454

55+
proc dup*[T](obj: T): T = obj
56+
5557
proc `$`*(p: ptr | ref): string = cast[int](p).toHex
5658
## Converts the pointer `p` to its hex string representation.
5759

src/nimblepkg/developfile.nim

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,7 @@ proc addPackage(data: var DevelopFileData, pkgInfo: PackageInfo,
246246
if pkg == nil:
247247
# If a package with `pkgInfo.name` is missing add it to the
248248
# `DevelopFileData` internal data structures add it.
249-
{.warning[ProveInit]: off.}
250249
pkg = pkgInfo.newClone
251-
{.warning[ProveInit]: on.}
252250
data.pkgRefCount.inc(pkg)
253251
data.nameToPkg[pkg[].basicInfo.name] = pkg
254252
data.pathToPkg[pkg[].getNimbleFilePath()] = pkg
@@ -387,7 +385,7 @@ proc load(path: Path, dependentPkg: PackageInfo, options: Options,
387385
# If this is a package develop file, but not a free one, for each of the
388386
# package's develop mode dependencies load its develop file if it is not
389387
# already loaded and merge its data to the current develop file's data.
390-
for path, pkg in result.pathToPkg:
388+
for path, pkg in result.pathToPkg.dup:
391389
if visitedPkgs.contains(path):
392390
continue
393391
var followedPkgDevFileData = initDevelopFileData()

0 commit comments

Comments
 (0)