summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-01-19 16:54:59 +0100
committerAraq <rumpf_a@web.de>2014-01-19 16:54:59 +0100
commit73c6efdf66dd62370cb04f7ce75640743905edc5 (patch)
tree5ffe8181b782134db74b439fedca073536f3a9f4 /lib/pure
parentcde9e5d64421e34d7d844c048213f01c40af5dd7 (diff)
downloadNim-73c6efdf66dd62370cb04f7ce75640743905edc5.tar.gz
'nil' as a statement is deprecated, use an empty 'discard' instead
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/json.nim3
-rw-r--r--lib/pure/osproc.nim2
-rw-r--r--lib/pure/parseutils.nim2
-rw-r--r--lib/pure/sockets.nim2
-rw-r--r--lib/pure/streams.nim2
-rw-r--r--lib/pure/strutils.nim2
-rw-r--r--lib/pure/times.nim2
7 files changed, 8 insertions, 7 deletions
diff --git a/lib/pure/json.nim b/lib/pure/json.nim
index 360a3a5e7..7424bbae9 100644
--- a/lib/pure/json.nim
+++ b/lib/pure/json.nim
@@ -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`
 
diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim
index fe4303d8a..7b59deec7 100644
--- a/lib/pure/osproc.nim
+++ b/lib/pure/osproc.nim
@@ -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 =
diff --git a/lib/pure/parseutils.nim b/lib/pure/parseutils.nim
index 6423b3ab0..484ba5184 100644
--- a/lib/pure/parseutils.nim
+++ b/lib/pure/parseutils.nim
@@ -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
diff --git a/lib/pure/sockets.nim b/lib/pure/sockets.nim
index de445dd36..b56153cc0 100644
--- a/lib/pure/sockets.nim
+++ b/lib/pure/sockets.nim
@@ -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) =
diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim
index 302742eb4..e944dd2fc 100644
--- a/lib/pure/streams.nim
+++ b/lib/pure/streams.nim
@@ -281,7 +281,7 @@ proc newFileStream*(filename: string, mode: TFileMode): PFileStream =
 
 
 when true:
-  nil
+  discard
 else:
   type
     TFileHandle* = cint ## Operating system file handle
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim
index 20109cfa2..de8dc5e51 100644
--- a/lib/pure/strutils.nim
+++ b/lib/pure/strutils.nim
@@ -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] {.
diff --git a/lib/pure/times.nim b/lib/pure/times.nim
index be3e5d6da..6186fcad8 100644
--- a/lib/pure/times.nim
+++ b/lib/pure/times.nim
@@ -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)