File tree 1 file changed +14
-14
lines changed
1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -67,16 +67,18 @@ block:
67
67
68
68
# Exception on access
69
69
doAssert (
70
- try :
71
- (discard rOk.tryError (); false )
72
- except ResultError [int ]:
73
- true
70
+ block :
71
+ try :
72
+ (discard rOk.tryError (); false )
73
+ except ResultError [int ]:
74
+ true
74
75
)
75
76
doAssert (
76
- try :
77
- (discard rErr.tryGet (); false )
78
- except ResultError [string ]:
79
- true
77
+ block :
78
+ try :
79
+ (discard rErr.tryGet (); false )
80
+ except ResultError [string ]:
81
+ true
80
82
)
81
83
82
84
# Value access or default
@@ -596,13 +598,11 @@ block: # `cstring` dangling reference protection
596
598
block : # Experiments
597
599
# Can formalise it into a template (https://github.com/arnetheduck/nim-result/issues/8)
598
600
template `?=` (v: untyped {nkIdent}, vv: Result ): bool =
599
- (
600
- let vr = vv
601
- template v (): auto {.used .} =
602
- unsafeGet (vr)
601
+ let vr = vv
602
+ template v (): auto {.used .} =
603
+ unsafeGet (vr)
603
604
604
- vr.isOk
605
- )
605
+ vr.isOk
606
606
607
607
if f ?= Result [int , string ].ok (42 ):
608
608
doAssert f == 42
You can’t perform that action at this time.
0 commit comments