3 ms·
The "fix" would be to return a Result. Which is a sum of an error and the type you want to return.
by rowanG077 4y ago
The "fix" would be to return a Result. Which is a sum of an error and the type you want to return.
- dietrichepp 4y agoYou can't return an Infallible, though, because it has no variants. You still need to do something at the point of unwrap().
- Macha 4y agoBut again, the function cannot fail. It could return a Result<Vec2, Infallible>, I guess, but then you're just pushing the unwrap to caller without any need to.
- rowanG077 4y agoThat's the entire point of the OP. That it can't fail so you might as well call unwrap.