Noticed this on usage of nim-results valueOr, but it happens for any similar call when used with : + parameter syntax style.
Example:
import results
func someSimpleResult(): Result[int, string] =
ok(1)
let res = someSimpleResult()
let test1 = res.valueOr:
2
let test2 = someSimpleResult().valueOr:
3
let test3 = (someSimpleResult()).valueOr:
4
After formatting:
import results
func someSimpleResult(): Result[int, string] =
ok(1)
let res = someSimpleResult()
let test1 = res.valueOr:
2
let test2 =
someSimpleResult().valueOr:
3
let test3 = (someSimpleResult()).valueOr:
4
As can be seen, test2 adds a new line, while for the more simpler res it does not. Putting brackets around it resolves it again.
Very basic test case:
func someSimpleFunction(): int =
1
func testThis(val: int, res: int): int =
if val == 1: res else: 0
let testa = 1.testThis:
1
let testb =
someSimpleFunction().testThis:
1
let testc = (someSimpleFunction()).testThis:
1
Noticed this on usage of nim-results
valueOr
, but it happens for any similar call when used with:
+ parameter syntax style.Example:
After formatting:
As can be seen, test2 adds a new line, while for the more simpler
res
it does not. Putting brackets around it resolves it again.Very basic test case: