diff options
author | Clay Sweetser <clay.sweetser@gmail.com> | 2014-02-15 18:57:03 -0500 |
---|---|---|
committer | Clay Sweetser <clay.sweetser@gmail.com> | 2014-02-15 18:57:03 -0500 |
commit | ce5a494927abf66cc39cf849b9c66e2dadbe579e (patch) | |
tree | a09a0e48025c79fee103b16f19140f533b7c6847 /tests/stdlib | |
parent | f701ee086aacf3ad9d4f58c20d5924fc0c5b3bb2 (diff) | |
download | Nim-ce5a494927abf66cc39cf849b9c66e2dadbe579e.tar.gz |
Changed tests and tools to use 'discard' statements instead of 'nil' for empty blocks.
Diffstat (limited to 'tests/stdlib')
-rw-r--r-- | tests/stdlib/tircbot.nim | 8 | ||||
-rw-r--r-- | tests/stdlib/tmath2.nim | 2 | ||||
-rw-r--r-- | tests/stdlib/tos.nim | 2 | ||||
-rw-r--r-- | tests/stdlib/tpegs.nim | 14 |
4 files changed, 13 insertions, 13 deletions
diff --git a/tests/stdlib/tircbot.nim b/tests/stdlib/tircbot.nim index 6008838ff..71ecb0b48 100644 --- a/tests/stdlib/tircbot.nim +++ b/tests/stdlib/tircbot.nim @@ -183,7 +183,7 @@ type channel: string timestamp: TTime case kind*: TSeenType - of PSeenJoin: nil + of PSeenJoin: discard of PSeenPart, PSeenQuit, PSeenMsg: msg: string of PSeenNick: @@ -200,7 +200,7 @@ proc setSeen(d: TDb, s: TSeen) = var hashToSet = @[("type", $s.kind.int), ("channel", s.channel), ("timestamp", $s.timestamp.int)] case s.kind - of PSeenJoin: nil + of PSeenJoin: discard of PSeenPart, PSeenMsg, PSeenQuit: hashToSet.add(("msg", s.msg)) of PSeenNick: @@ -338,7 +338,7 @@ proc hubConnect(state: PState) = proc handleIrc(irc: PAsyncIRC, event: TIRCEvent, state: PState) = case event.typ - of EvConnected: nil + of EvConnected: discard of EvDisconnected: while not state.ircClient.isConnected: try: @@ -424,7 +424,7 @@ proc handleIrc(irc: PAsyncIRC, event: TIRCEvent, state: PState) = seenNick.newNick = event.params[0] state.database.setSeen(seenNick) else: - nil # TODO: ? + discard # TODO: ? proc open(port: TPort = TPort(5123)): PState = var res: PState diff --git a/tests/stdlib/tmath2.nim b/tests/stdlib/tmath2.nim index 6a1dae54d..935b08634 100644 --- a/tests/stdlib/tmath2.nim +++ b/tests/stdlib/tmath2.nim @@ -1,7 +1,7 @@ # tests for the interpreter proc loops(a: var int) = - nil + discard #var # b: int #b = glob diff --git a/tests/stdlib/tos.nim b/tests/stdlib/tos.nim index fa9993cc9..ebe577b00 100644 --- a/tests/stdlib/tos.nim +++ b/tests/stdlib/tos.nim @@ -7,6 +7,6 @@ proc walkDirTree(root: string) = case k of pcFile, pcLinkToFile: echo(f) of pcDir: walkDirTree(f) - of pcLinkToDir: nil + of pcLinkToDir: discard walkDirTree(".") diff --git a/tests/stdlib/tpegs.nim b/tests/stdlib/tpegs.nim index bdd8db0f8..7775091a1 100644 --- a/tests/stdlib/tpegs.nim +++ b/tests/stdlib/tpegs.nim @@ -72,7 +72,7 @@ type rule: TNode ## the rule that the symbol refers to TNode {.final, shallow.} = object case kind: TPegKind - of pkEmpty..pkWhitespace: nil + of pkEmpty..pkWhitespace: discard of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle: term: string of pkChar, pkGreedyRepChar: ch: char of pkCharChoice, pkGreedyRepSet: charChoice: ref set[char] @@ -123,7 +123,7 @@ proc add(d: var TPeg, s: TPeg) {.inline.} = add(d.sons, s) proc copyPeg(a: TPeg): TPeg = result.kind = a.kind case a.kind - of pkEmpty..pkWhitespace: nil + of pkEmpty..pkWhitespace: discard of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle: result.term = a.term of pkChar, pkGreedyRepChar: @@ -229,7 +229,7 @@ when false: case a.kind of pkEmpty, pkAny, pkAnyRune, pkGreedyAny, pkNewLine, pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle, pkChar, pkGreedyRepChar, - pkCharChoice, pkGreedyRepSet: nil + pkCharChoice, pkGreedyRepSet: discard of pkNonTerminal: return true else: for i in 0..a.sons.len-1: @@ -318,7 +318,7 @@ proc backrefIgnoreStyle*(index: range[1..MaxSubPatterns]): TPeg {. proc spaceCost(n: TPeg): int = case n.kind - of pkEmpty: nil + of pkEmpty: discard of pkTerminal, pkTerminalIgnoreCase, pkTerminalIgnoreStyle, pkChar, pkGreedyRepChar, pkCharChoice, pkGreedyRepSet, pkAny..pkWhitespace, pkGreedyAny: @@ -1111,7 +1111,7 @@ proc handleHexChar(c: var TPegLexer, xi: var int) = of 'A'..'F': xi = (xi shl 4) or (ord(c.buf[c.bufpos]) - ord('A') + 10) inc(c.bufpos) - else: nil + else: discard proc getEscapedChar(c: var TPegLexer, tok: var TToken) = inc(c.bufpos) @@ -1341,7 +1341,7 @@ proc getTok(c: var TPegLexer, tok: var TToken) = of "i": tok.modifier = modIgnoreCase of "y": tok.modifier = modIgnoreStyle of "v": tok.modifier = modVerbatim - else: nil + else: discard setLen(tok.literal, 0) if c.buf[c.bufpos] == '$': getDollar(c, tok) @@ -1488,7 +1488,7 @@ proc primary(p: var TPegParser): TPeg = of tkCurlyAt: getTok(p) return !*\primary(p).token(p) - else: nil + else: discard case p.tok.kind of tkIdentifier: if p.identIsVerbatim: |