Skip to content

Commit 0bc501e

Browse files
committed
Fix mutability in doc tests for BTreeSet cursors
1 parent cbdc377 commit 0bc501e

File tree

1 file changed

+10
-10
lines changed
  • library/alloc/src/collections/btree

1 file changed

+10
-10
lines changed

library/alloc/src/collections/btree/set.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1250,16 +1250,16 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
12501250
/// let mut set = BTreeSet::from([1, 2, 3, 4]);
12511251
///
12521252
/// let mut cursor = set.lower_bound_mut(Bound::Included(&2));
1253-
/// assert_eq!(cursor.peek_prev(), Some(&mut 1));
1254-
/// assert_eq!(cursor.peek_next(), Some(&mut 2));
1253+
/// assert_eq!(cursor.peek_prev(), Some(&1));
1254+
/// assert_eq!(cursor.peek_next(), Some(&2));
12551255
///
12561256
/// let mut cursor = set.lower_bound_mut(Bound::Excluded(&2));
1257-
/// assert_eq!(cursor.peek_prev(), Some(&mut 2));
1258-
/// assert_eq!(cursor.peek_next(), Some(&mut 3));
1257+
/// assert_eq!(cursor.peek_prev(), Some(&2));
1258+
/// assert_eq!(cursor.peek_next(), Some(&3));
12591259
///
12601260
/// let mut cursor = set.lower_bound_mut(Bound::Unbounded);
12611261
/// assert_eq!(cursor.peek_prev(), None);
1262-
/// assert_eq!(cursor.peek_next(), Some(&mut 1));
1262+
/// assert_eq!(cursor.peek_next(), Some(&1));
12631263
/// ```
12641264
#[unstable(feature = "btree_cursors", issue = "107540")]
12651265
pub fn lower_bound_mut<Q: ?Sized>(&mut self, bound: Bound<&Q>) -> CursorMut<'_, T, A>
@@ -1336,15 +1336,15 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
13361336
/// let mut set = BTreeSet::from([1, 2, 3, 4]);
13371337
///
13381338
/// let mut cursor = unsafe { set.upper_bound_mut(Bound::Included(&3)) };
1339-
/// assert_eq!(cursor.peek_prev(), Some(&mut 3));
1340-
/// assert_eq!(cursor.peek_next(), Some(&mut 4));
1339+
/// assert_eq!(cursor.peek_prev(), Some(&3));
1340+
/// assert_eq!(cursor.peek_next(), Some(&4));
13411341
///
13421342
/// let mut cursor = unsafe { set.upper_bound_mut(Bound::Excluded(&3)) };
1343-
/// assert_eq!(cursor.peek_prev(), Some(&mut 2));
1344-
/// assert_eq!(cursor.peek_next(), Some(&mut 3));
1343+
/// assert_eq!(cursor.peek_prev(), Some(&2));
1344+
/// assert_eq!(cursor.peek_next(), Some(&3));
13451345
///
13461346
/// let mut cursor = unsafe { set.upper_bound_mut(Bound::Unbounded) };
1347-
/// assert_eq!(cursor.peek_prev(), Some(&mut 4));
1347+
/// assert_eq!(cursor.peek_prev(), Some(&4));
13481348
/// assert_eq!(cursor.peek_next(), None);
13491349
/// ```
13501350
#[unstable(feature = "btree_cursors", issue = "107540")]

0 commit comments

Comments
 (0)