Skip to content
Myr

Merge pull request #117 from timvisee/master

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

Show use of bail! for early return in README

authored by David Tolnay · committed by GitHub · parents fd0268b, 4df08ec · Browse files · 1 file+4 added−1 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+4 added−1 removed

  • other:+4 added−1 removed

1 file+4 added−1 removed

modified:README.md+4 added-1 removed
110 unmodified lines
111 }112 ```113114- One-off error messages can be constructed using the `anyhow!` macro, which115 supports string interpolation and produces an `anyhow::Error`.115 supports string interpolation and produces an `anyhow::Error`. Use `bail!` as116 shorthand to return early with an error.117118 ```rust119 return Err(anyhow!("Missing attribute: {}", missing));120 // or121 bail!("Missing attribute: {}", missing);122 ```123124<br>125
54 unmodified lines