Revert "Allow comparing Result[void, E] (#71)" (#73)

This reverts commit 068412ff4e.
This commit is contained in:
Mamy Ratsimbazafy 2021-01-26 14:20:09 +01:00 committed by GitHub
parent 068412ff4e
commit b4b3841a85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 10 deletions

View File

@ -442,14 +442,11 @@ template capture*[E: Exception](T: type, someExceptionExpr: ref E): Result[T, re
ret = R.err(caught)
ret
func `==`*[T, E](lhs: Result[T, E], rhs: Result[T, E]): bool {.inline.} =
func `==`*[T0, E0, T1, E1](lhs: Result[T0, E0], rhs: Result[T1, E1]): bool {.inline.} =
if lhs.o != rhs.o:
false
elif lhs.o: # and rhs.o implied
when T is void:
true
else:
lhs.v == rhs.v
lhs.v == rhs.v
else:
lhs.e == rhs.e

View File

@ -275,8 +275,3 @@ func cstringF(s: string): CSRes =
doAssert false
discard cstringF("test")
# Compare void
block:
var a, b: Result[void, bool]
discard a == b