This repository was archived by the owner on Aug 7, 2024. It is now read-only.
Is it possible to replace try! with ? #7
Closed
Description
I'm trying to write a rule that replaces try!(x)
with x?
, but it seems tricky.
This seems to compile (I've had to add a return type):
fn rule1<T,E,X: From<E>>(r: Result<T,E>) -> Result<T,X> {
replace!(try!(r) => r?);
Ok(r?)
}
but it doesn't match anything. Without return type I can't use try!
nor ?
in the pattern, since they expand to return
, which rustc typechecks.
Can this replacement be done?
Metadata
Metadata
Assignees
Labels
No labels