top | item 36843524

(no title)

stefncb | 2 years ago

It's actually not. There's simply a 'use Option::{None, Some}' built-in to make them easier to work with.

discuss

order

estebank|2 years ago

The GP is referencing cases where inference can't figure out what the T is in Option::<T>::None. This can happen in the body of a closure without an explicit return type, for example. To solve it you have to specify the type either earlier in a place that helps inference (in the example, add a return type) or in the expression, like None::<()>.

stefncb|2 years ago

Yeah sorry I apparently can't read, it was pretty obvious. Thanks.