How can I assert that a function produces an Ok result, otherwise panic?

Viewed 963

When a function errors in a test, I use this pattern:

if let Err(err) = func() {
    panic!("got error on export: {:?}", err);
}

Is there a macro for asserting an Ok result and get the Err printed otherwise?

0 Answers
Related