I have working code which returns errors in the following way:
fn foo() -> anyhow::Result<()> {
...
Err(anyhow::Error::new(
MyError::MyVariant {
actual: 0,
expected: 1
}
))
}
Is there a more concise way of returning an instance of MyError?
(Omitting the anyhow::Error::new( wrapper causes a type-checking error, as MyError is not an instance of anyhow::Error.)