[other] prettify collections (#11695)

This commit is contained in:
Miran 2019-07-09 22:45:23 +02:00 • committed by GitHub
commit 2255d8795b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 209 additions and 186 deletions

View file

@ -600,17 +600,17 @@ proc rightSize*(count: Natural): int {.inline.} =
## expected extra amount to the parameter before calling this.
##
## Internally, we want `mustRehash(rightSize(x), x) == false`.
result = nextPowerOfTwo(count * 3 div 2 + 4)
result = nextPowerOfTwo(count * 3 div 2 + 4)
proc initSet*[A](initialSize = defaultInitialSize): HashSet[A] {.deprecated:
"Deprecated since v0.20, use 'initHashSet'"} = initHashSet[A](initialSize)
"Deprecated since v0.20, use 'initHashSet'".} = initHashSet[A](initialSize)
proc toSet*[A](keys: openArray[A]): HashSet[A] {.deprecated:
"Deprecated since v0.20, use 'toHashSet'"} = toHashSet[A](keys)
"Deprecated since v0.20, use 'toHashSet'".} = toHashSet[A](keys)
proc isValid*[A](s: HashSet[A]): bool {.deprecated:
"Deprecated since v0.20; sets are initialized by default"} =
"Deprecated since v0.20; sets are initialized by default".} =
## Returns `true` if the set has been initialized (with `initHashSet proc
## <#initHashSet,int>`_ or `init proc <#init,HashSet[A],int>`_).
##
@ -937,7 +937,7 @@ iterator pairs*[A](s: OrderedSet[A]): tuple[a: int, b: A] =
proc isValid*[A](s: OrderedSet[A]): bool {.deprecated:
"Deprecated since v0.20; sets are initialized by default"} =
"Deprecated since v0.20; sets are initialized by default".} =
##
## Returns `true` if the set has been initialized (with `initHashSet proc
## <#initOrderedSet,int>`_ or `init proc <#init,OrderedSet[A],int>`_).
@ -1162,8 +1162,8 @@ when isMainModule and not defined(release):
var aa = initOrderedSet[pair]()
var bb = initOrderedSet[pair]()
var x = (a:1,b:2)
var y = (a:3,b:4)
var x = (a: 1, b: 2)
var y = (a: 3, b: 4)
aa.incl(x)
aa.incl(y)