Skip to content

Commit

Permalink
Use ? propagation in doc comment example
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzgen committed Sep 13, 2024
1 parent 17647a1 commit ef80790
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 ef80790

Please sign in to comment.