Don't rely on the side-effects from doAssert

This commit is contained in:
Zahary Karadjov 2020-06-05 18:40:30 +03:00
parent 828a80ec8f
commit 2aebae56c0
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 4 additions and 2 deletions

View File

@ -834,9 +834,11 @@ proc init*(mtype: typedesc[MultiAddress],
var data = initVBuffer() var data = initVBuffer()
data.write(familyProto.mcodec) data.write(familyProto.mcodec)
doAssert familyProto.coder.stringToBuffer($address, data) var written = familyProto.coder.stringToBuffer($address, data)
doAssert written, "Merely writing a string to a buffer should always be possible"
data.write(protoProto.mcodec) data.write(protoProto.mcodec)
doAssert protoProto.coder.stringToBuffer($port, data) written = protoProto.coder.stringToBuffer($port, data)
doAssert written, "Merely writing a string to a buffer should always be possible"
data.finish() data.finish()
MultiAddress(data: data) MultiAddress(data: data)