Skip to content

Commit

Permalink
Merge pull request #197 from fitzgen/doc-comment-example
Browse files Browse the repository at this point in the history
Use `?` propagation in doc comment example
  • Loading branch information
fitzgen authored Sep 13, 2024
2 parents 17647a1 + ef80790 commit 365e73b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/unstructured.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,16 @@ impl<'a> Unstructured<'a> {
/// # Example
///
/// ```
/// # fn foo() -> arbitrary::Result<()> {
/// use arbitrary::{Arbitrary, Unstructured};
///
/// let mut u = Unstructured::new(&[1, 2, 3, 4]);
///
/// let x: i32 = u.int_in_range(-5_000..=-1_000)
/// .expect("constructed `u` with enough bytes to generate an `i32`");
/// let x: i32 = u.int_in_range(-5_000..=-1_000)?;
///
/// assert!(-5_000 <= x);
/// assert!(x <= -1_000);
/// # Ok(()) }
/// ```
pub fn int_in_range<T>(&mut self, range: ops::RangeInclusive<T>) -> Result<T>
where
Expand Down

0 comments on commit 365e73b

Please sign in to comment.