mirror of https://github.com/vacp2p/nim-libp2p.git
remove unnecesary nil check in peerinfo
This commit is contained in:
parent
0349165830
commit
26a4510377
|
@ -105,13 +105,9 @@ proc publicKey*(p: PeerInfo): Option[PublicKey] {.inline.} =
|
||||||
result = some(p.privateKey.getKey())
|
result = some(p.privateKey.getKey())
|
||||||
|
|
||||||
proc id*(p: PeerInfo): string {.inline.} =
|
proc id*(p: PeerInfo): string {.inline.} =
|
||||||
if not isNil(p):
|
p.peerId.pretty()
|
||||||
result = p.peerId.pretty()
|
|
||||||
|
|
||||||
proc `$`*(p: PeerInfo): string =
|
proc `$`*(p: PeerInfo): string =
|
||||||
if isNil(p):
|
|
||||||
return ""
|
|
||||||
|
|
||||||
result.add("PeerID: ")
|
result.add("PeerID: ")
|
||||||
result.add(p.id & "\n")
|
result.add(p.id & "\n")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue