Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit 62627ed

Browse files
dead10ckYamakaky
authored andcommitted
Modify the crate docs for bail!
The docs currently say that the bail! macro is like using try! or ?. This isn't really correct. `try!` and `?` operate on a `Result` type, returning the `Ok` value, if it is `Ok`, or returning early from the function if it is an `Err`. `bail!` is equivalent to just returning an `Err`, period. This change makes that a little more clear.
1 parent 09ba055 commit 62627ed

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,10 @@
231231
//! ## The `bail!` macro
232232
//!
233233
//! The above method of introducing new errors works but is a little
234-
//! verbose. Instead we can use the `bail!` macro, which, much like `try!`
235-
//! and `?`, performs an early return with conversions. With `bail!` the
236-
//! previous examples look like:
234+
//! verbose. Instead, we can use the `bail!` macro, which performs an early return
235+
//! with conversions done automatically.
236+
//!
237+
//! With `bail!` the previous examples look like:
237238
//!
238239
//! ```
239240
//! # #[macro_use] extern crate error_chain;

0 commit comments

Comments
 (0)