Skip to content

Commit 468b45e

Browse files
committed
doc: reduce the scope of unsafe in the from_bits_unchecked example
1 parent 76f8b87 commit 468b45e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,13 @@ pub trait BitFlag: Copy + Clone + 'static + _internal::RawBitFlags {
268268
///
269269
/// use enumflags2::BitFlag;
270270
///
271-
/// unsafe {
272-
/// let from_bits = MyFlag::from_bits_unchecked(0b011);
273-
/// assert_eq!(from_bits.contains(MyFlag::One), true);
274-
/// assert_eq!(from_bits.contains(MyFlag::Two), true);
275-
/// assert_eq!(from_bits.contains(MyFlag::Three), false);
276-
/// }
271+
/// let from_bits = unsafe {
272+
/// MyFlag::from_bits_unchecked(0b011)
273+
/// };
274+
///
275+
/// assert_eq!(from_bits.contains(MyFlag::One), true);
276+
/// assert_eq!(from_bits.contains(MyFlag::Two), true);
277+
/// assert_eq!(from_bits.contains(MyFlag::Three), false);
277278
/// ```
278279
///
279280
/// # Safety

0 commit comments

Comments
 (0)