Skip to content
Myr

Fix the expression that `bail!` and `ensure!` are equivalent to

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent 9a95ce8 · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:src/macros.rs+2 added-2 removed
1/// Return early with an error.2///3/// This macro is equivalent to `return Err(From::from($err))`.3/// This macro is equivalent to `return Err(anyhow!($args...))`.4///5/// # Example6///7/// ```
53 unmodified lines
61}6263/// Return early with an error if a condition is not satisfied.64///65/// This macro is equivalent to `if !$cond { return Err(From::from($err)); }`.65/// This macro is equivalent to `if !$cond { return Err(anyhow!($args...)); }`.66///67/// Analogously to `assert!`, `ensure!` takes a condition and exits the function68/// if the condition fails. Unlike `assert!`, `ensure!` returns an `Error`69/// rather than panicking.
100 unmodified lines