3 ms·
I'm not familiar with Rust, but it sounds like a similar story to `?`, `!`, `rethrows`, and `fatalError` in Swift. I.e.: - Handle nil cases with ? or propagate
by happytoexplain 4y ago
I'm not familiar with Rust, but it sounds like a similar story to `?`, `!`, `rethrows`, and `fatalError` in Swift. I.e.:
- Handle nil cases with ? or propagate errors with rethrows.
- If you really, seriously can't recover, use fatalError with a descriptive message.
- ! is strictly for non-production code. It is just a hyper-short way of fatally failing with no message. Yes, maybe you can use it if you just checked for nil, but almost always you can refactor that to omit the !. Because of its convenience, people tend to abuse it.