Adding @discardableResult
to .withExhaustivity()
?
#2419
Replies: 1 comment 1 reply
-
Hi @LudvigIversen, ideally And also we don't think it's appropriate to discard the result of withAnimation(.default) {
somethingThatDiscardsResult()
} …will also have a warning. As such we don't think there's anything we can really do about it, and sadly you just have to litter |
Beta Was this translation helpful? Give feedback.
-
Hello!
When working with test there are scenarios were we have a
.send()
operation followed by a.receive()
like this for exampleNow, let us say that
actionA
does some state changes that we for any reason don't want to assert on, in my case it is because the changes are outside of the scope of our test.Now, there is functionality to do this using the
withExhaustivity()
function, like so;Now this works, but there is an annoyance with this, and that is the warning that appears notifying us that the return of
withExhaustivity
is unused. To avoid this you can of course just put_ =
in front of the call, however I believe that this is something that should be avoided.It is possible to achieve this by annotating the function with
@discardableResult
which would result in not needing the_ =
whilst also avoiding the warning.Understandable if there are reasons as to why this is not already the case, but if so, I would gladly hear that reason. Otherwise I believe this could be a great quality of life change.
Beta Was this translation helpful? Give feedback.
All reactions