don't use result in oneliners

This commit is contained in:
Dmitriy Ryajov 2019-09-25 13:34:01 -06:00
parent 759355b364
commit b5c4eaf9b8
1 changed files with 7 additions and 7 deletions

View File

@ -35,44 +35,44 @@ method readExactly*(s: Connection,
pbytes: pointer, pbytes: pointer,
nbytes: int): nbytes: int):
Future[void] {.gcsafe.} = Future[void] {.gcsafe.} =
result = s.stream.readExactly(pbytes, nbytes) s.stream.readExactly(pbytes, nbytes)
method readLine*(s: Connection, method readLine*(s: Connection,
limit = 0, limit = 0,
sep = "\r\n"): sep = "\r\n"):
Future[string] {.gcsafe.} = Future[string] {.gcsafe.} =
result = s.stream.readLine(limit, sep) s.stream.readLine(limit, sep)
method readOnce*(s: Connection, method readOnce*(s: Connection,
pbytes: pointer, pbytes: pointer,
nbytes: int): nbytes: int):
Future[int] {.gcsafe.} = Future[int] {.gcsafe.} =
result = s.stream.readOnce(pbytes, nbytes) s.stream.readOnce(pbytes, nbytes)
method readUntil*(s: Connection, method readUntil*(s: Connection,
pbytes: pointer, pbytes: pointer,
nbytes: int, nbytes: int,
sep: seq[byte]): sep: seq[byte]):
Future[int] {.gcsafe.} = Future[int] {.gcsafe.} =
result = s.stream.readUntil(pbytes, nbytes, sep) s.stream.readUntil(pbytes, nbytes, sep)
method write*(s: Connection, method write*(s: Connection,
pbytes: pointer, pbytes: pointer,
nbytes: int): nbytes: int):
Future[void] {.gcsafe.} = Future[void] {.gcsafe.} =
result = s.stream.write(pbytes, nbytes) s.stream.write(pbytes, nbytes)
method write*(s: Connection, method write*(s: Connection,
msg: string, msg: string,
msglen = -1): msglen = -1):
Future[void] {.gcsafe.} = Future[void] {.gcsafe.} =
result = s.stream.write(msg, msglen) s.stream.write(msg, msglen)
method write*(s: Connection, method write*(s: Connection,
msg: seq[byte], msg: seq[byte],
msglen = -1): msglen = -1):
Future[void] {.gcsafe.} = Future[void] {.gcsafe.} =
result = s.stream.write(msg, msglen) s.stream.write(msg, msglen)
method close*(s: Connection) {.async, gcsafe.} = method close*(s: Connection) {.async, gcsafe.} =
await s.stream.close() await s.stream.close()