'nil' as a statement is deprecated, use an empty 'discard' instead
This commit is contained in:
parent
cde9e5d644
commit
73c6efdf66
54 changed files with 170 additions and 170 deletions
|
|
@ -626,7 +626,7 @@ proc len*(n: PJsonNode): int =
|
|||
case n.kind
|
||||
of JArray: result = n.elems.len
|
||||
of JObject: result = n.fields.len
|
||||
else: nil
|
||||
else: discard
|
||||
|
||||
proc `[]`*(node: PJsonNode, name: string): PJsonNode =
|
||||
## Gets a field from a `JObject`. Returns nil if the key is not found.
|
||||
|
|
@ -646,6 +646,7 @@ proc hasKey*(node: PJsonNode, key: string): bool =
|
|||
assert(node.kind == JObject)
|
||||
for k, item in items(node.fields):
|
||||
if k == key: return true
|
||||
|
||||
proc existsKey*(node: PJsonNode, key: string): bool {.deprecated.} = node.hasKey(key)
|
||||
## Deprecated for `hasKey`
|
||||
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ when defined(Windows) and not defined(useNimRtl):
|
|||
handle: THandle
|
||||
atTheEnd: bool
|
||||
|
||||
proc hsClose(s: PStream) = nil # nothing to do here
|
||||
proc hsClose(s: PStream) = discard # nothing to do here
|
||||
proc hsAtEnd(s: PStream): bool = return PFileHandleStream(s).atTheEnd
|
||||
|
||||
proc hsReadData(s: PStream, buffer: pointer, bufLen: int): int =
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ iterator interpolatedFragments*(s: string): tuple[kind: TInterpolatedKind,
|
|||
of '\0':
|
||||
raise newException(EInvalidValue,
|
||||
"Expected closing '}': " & s[i..s.len])
|
||||
else: nil
|
||||
else: discard
|
||||
inc j
|
||||
inc i, 2 # skip ${
|
||||
kind = ikExpr
|
||||
|
|
|
|||
|
|
@ -1523,7 +1523,7 @@ proc skip*(socket: TSocket) {.tags: [FReadIO], deprecated.} =
|
|||
## **Deprecated since version 0.9.2**: This function is not safe for use.
|
||||
const bufSize = 1000
|
||||
var buf = alloc(bufSize)
|
||||
while recv(socket, buf, bufSize) == bufSize: nil
|
||||
while recv(socket, buf, bufSize) == bufSize: discard
|
||||
dealloc(buf)
|
||||
|
||||
proc skip*(socket: TSocket, size: int, timeout = -1) =
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ proc newFileStream*(filename: string, mode: TFileMode): PFileStream =
|
|||
|
||||
|
||||
when true:
|
||||
nil
|
||||
discard
|
||||
else:
|
||||
type
|
||||
TFileHandle* = cint ## Operating system file handle
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ proc countLines*(s: string): int {.noSideEffect,
|
|||
if s[i+1] == '\l': inc i
|
||||
inc result
|
||||
of '\l': inc result
|
||||
else: nil
|
||||
else: discard
|
||||
inc i
|
||||
|
||||
proc split*(s: string, seps: set[char] = Whitespace): seq[string] {.
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@ proc format*(info: TTimeInfo, f: string): string =
|
|||
of "ZZZ":
|
||||
result.add(info.tzname)
|
||||
of "":
|
||||
nil # Do nothing.
|
||||
discard
|
||||
else:
|
||||
raise newException(EInvalidValue, "Invalid format string: " & currentF)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue