Skip to content

Commit eb63168

Browse files
committed
Fix doctests
1 parent 1095dca commit eb63168

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

library/core/src/ops/range.rs

+8
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,8 @@ pub trait RangeBounds<T: ?Sized> {
751751
/// ```
752752
/// #![feature(range_bounds_for_length)]
753753
///
754+
/// use std::ops::RangeBounds;
755+
///
754756
/// let v = [10, 40, 30];
755757
/// assert_eq!(1..2, (1..2).for_length(v.len()));
756758
/// assert_eq!(0..2, (..2).for_length(v.len()));
@@ -762,18 +764,24 @@ pub trait RangeBounds<T: ?Sized> {
762764
/// ```should_panic
763765
/// #![feature(range_bounds_for_length)]
764766
///
767+
/// use std::ops::RangeBounds;
768+
///
765769
/// (2..1).for_length(3);
766770
/// ```
767771
///
768772
/// ```should_panic
769773
/// #![feature(range_bounds_for_length)]
770774
///
775+
/// use std::ops::RangeBounds;
776+
///
771777
/// (1..4).for_length(3);
772778
/// ```
773779
///
774780
/// ```should_panic
775781
/// #![feature(range_bounds_for_length)]
776782
///
783+
/// use std::ops::RangeBounds;
784+
///
777785
/// (1..=usize::MAX).for_length(3);
778786
/// ```
779787
///

0 commit comments

Comments
 (0)