Skip to content

Commit ef80790

Browse files
committed
Use ? propagation in doc comment example
1 parent 17647a1 commit ef80790

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/unstructured.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,16 @@ impl<'a> Unstructured<'a> {
281281
/// # Example
282282
///
283283
/// ```
284+
/// # fn foo() -> arbitrary::Result<()> {
284285
/// use arbitrary::{Arbitrary, Unstructured};
285286
///
286287
/// let mut u = Unstructured::new(&[1, 2, 3, 4]);
287288
///
288-
/// let x: i32 = u.int_in_range(-5_000..=-1_000)
289-
/// .expect("constructed `u` with enough bytes to generate an `i32`");
289+
/// let x: i32 = u.int_in_range(-5_000..=-1_000)?;
290290
///
291291
/// assert!(-5_000 <= x);
292292
/// assert!(x <= -1_000);
293+
/// # Ok(()) }
293294
/// ```
294295
pub fn int_in_range<T>(&mut self, range: ops::RangeInclusive<T>) -> Result<T>
295296
where

0 commit comments

Comments
 (0)