Fix mutability in doc tests for BTreeSet cursors · model-checking/verify-rust-std@86ea79f (original) (raw)

`@@ -1250,16 +1250,16 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {

`

1250

1250

`/// let mut set = BTreeSet::from([1, 2, 3, 4]);

`

1251

1251

`///

`

1252

1252

`/// 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));

`

1255

1255

`///

`

1256

1256

`/// 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));

`

1259

1259

`///

`

1260

1260

`/// let mut cursor = set.lower_bound_mut(Bound::Unbounded);

`

1261

1261

`/// assert_eq!(cursor.peek_prev(), None);

`

1262

``

`-

/// assert_eq!(cursor.peek_next(), Some(&mut 1));

`

``

1262

`+

/// assert_eq!(cursor.peek_next(), Some(&1));

`

1263

1263

```` /// ```


`1264`

`1264`

`#[unstable(feature = "btree_cursors", issue = "107540")]

`

`1265`

`1265`

`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> {

`

`1336`

`1336`

`/// let mut set = BTreeSet::from([1, 2, 3, 4]);

`

`1337`

`1337`

`///

`

`1338`

`1338`

`/// 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));

`

`1341`

`1341`

`///

`

`1342`

`1342`

`/// 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));

`

`1345`

`1345`

`///

`

`1346`

`1346`

`/// 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));

`

`1348`

`1348`

`/// assert_eq!(cursor.peek_next(), None);

`

`1349`

`1349`

```` /// ```

1350

1350

`#[unstable(feature = "btree_cursors", issue = "107540")]

`