Closed
Description
This example compiles successfully:
fn f2() -> Result<i32, String> {
unimplemented!()
}
fn f1() -> Result<i64, String> {
match f2() {
Ok(value) => Ok(value as i64),
Err(err) => Err(err),
}
}
However, this example does not:
fn f2() -> Result<i32, String> {
unimplemented!()
}
fn f1() -> Result<i64, String> {
match f2() {
Ok(value) => Ok(value as i64),
err => err,
}
}
Obviously, err
can only be of Err(e)
kind so it's correct to return it from f1()
.