Skip to content

Commit 014bf65

Browse files
GrigorenkoPVgitbot
authored and
gitbot
committed
Remove erroneous unsafe in BTreeSet::upper_bound_mut
1 parent d9fc6c7 commit 014bf65

File tree

1 file changed

+4
-4
lines changed
  • alloc/src/collections/btree

1 file changed

+4
-4
lines changed

alloc/src/collections/btree/set.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1442,20 +1442,20 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
14421442
///
14431443
/// let mut set = BTreeSet::from([1, 2, 3, 4]);
14441444
///
1445-
/// let mut cursor = unsafe { set.upper_bound_mut(Bound::Included(&3)) };
1445+
/// let mut cursor = set.upper_bound_mut(Bound::Included(&3));
14461446
/// assert_eq!(cursor.peek_prev(), Some(&3));
14471447
/// assert_eq!(cursor.peek_next(), Some(&4));
14481448
///
1449-
/// let mut cursor = unsafe { set.upper_bound_mut(Bound::Excluded(&3)) };
1449+
/// let mut cursor = set.upper_bound_mut(Bound::Excluded(&3));
14501450
/// assert_eq!(cursor.peek_prev(), Some(&2));
14511451
/// assert_eq!(cursor.peek_next(), Some(&3));
14521452
///
1453-
/// let mut cursor = unsafe { set.upper_bound_mut(Bound::Unbounded) };
1453+
/// let mut cursor = set.upper_bound_mut(Bound::Unbounded);
14541454
/// assert_eq!(cursor.peek_prev(), Some(&4));
14551455
/// assert_eq!(cursor.peek_next(), None);
14561456
/// ```
14571457
#[unstable(feature = "btree_cursors", issue = "107540")]
1458-
pub unsafe fn upper_bound_mut<Q: ?Sized>(&mut self, bound: Bound<&Q>) -> CursorMut<'_, T, A>
1458+
pub fn upper_bound_mut<Q: ?Sized>(&mut self, bound: Bound<&Q>) -> CursorMut<'_, T, A>
14591459
where
14601460
T: Borrow<Q> + Ord,
14611461
Q: Ord,

0 commit comments

Comments
 (0)