Open
Description
The following code uses String::from
fn bar() -> Result<i32, String> {
let x = Some(52.3).ok_or_else(|| String::from("foo"))?;
Ok(42)
}
but Some(52.3).ok_or("foo")?;
would also compile
So if an ok_or_else
is followed by a ?
and the inner function is calling From::from
(or a specific version of it), we should be able to convert it to an ok_or
without that call.