4 ms·
Which you'd never write in practice since `expect` exists
by timidger 6y ago
Which you'd never write in practice since `expect` exists
- vikiomega9 6y agoCan you say more here, I don't have the context.
- steveklabnik 6y agoThis code is identical to let file = file.expect("file was null"); That is, the "expect" method does exactly this.
- jeswin 6y agoI like Rust from what I've tried. But I'd have preferred something like this: let file = file.unwrapOrPanicWith("file was null"); option.expect(message) doesn't semantically make sense.
- jack1243star 6y agoI read it as expect (prepare) for the worst!
- steveklabnik 6y agoThere was some discussion about this when the method was named; you're not alone. In the end, it is what it is. You could define your own method like that if you really wanted to.