I just saw the following change in a pull request:
- .ok_or(Error::new(ErrorKind::Other, "Decode error"));
+ .ok_or_else(|| Error::new(ErrorKind::Other, "Decode error"));
The only differences I know are:
- In
ok_orwe have already createdErrorbyError::newand passed it into a adaptor. - In
ok_or_elsewe have passed a closure which will produce such a value but it may not be called if there isSomedata in theOption.
Did I miss anything?