Skip to content

Commit 92cf34c

Browse files
committed
Avoid deprecated methods.
1 parent 20b1b19 commit 92cf34c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
)]
7777
#![cfg_attr(not(feature = "std"), no_std)]
7878
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
79-
#![cfg_attr(miri, feature(strict_provenance), feature(maybe_uninit_slice))]
79+
#![cfg_attr(miri, feature(maybe_uninit_slice))]
8080

8181
#[inline(always)]
8282
fn maybe_grow<R, F: FnOnce() -> R>(callback: F) -> R {
@@ -1381,9 +1381,10 @@ where
13811381
/// let mut s = array![0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55];
13821382
/// let num = 42;
13831383
/// let idx = s.partition_point(|&x| x < num);
1384-
/// let mut s = s.into_raw_vec();
1385-
/// s.insert(idx, num);
1386-
/// assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
1384+
/// let (mut s, off) = s.into_raw_vec_and_offset();
1385+
/// let off = off.unwrap_or_default();
1386+
/// s.insert(off + idx, num);
1387+
/// assert_eq!(s[off..], [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
13871388
/// ```
13881389
#[must_use]
13891390
fn partition_point<P>(&self, pred: P) -> usize
@@ -1500,9 +1501,10 @@ where
15001501
/// let num = 42;
15011502
/// let idx = s.partition_point(|&x| x < num);
15021503
/// // The above is equivalent to `let idx = s.binary_search(&num).unwrap_or_else(|x| x);`
1503-
/// let mut s = s.into_raw_vec();
1504-
/// s.insert(idx, num);
1505-
/// assert_eq!(s, [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
1504+
/// let (mut s, off) = s.into_raw_vec_and_offset();
1505+
/// let off = off.unwrap_or_default();
1506+
/// s.insert(off + idx, num);
1507+
/// assert_eq!(s[off..], [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 42, 55]);
15061508
/// ```
15071509
fn binary_search(&self, x: &A) -> Result<usize, usize>
15081510
where

0 commit comments

Comments
 (0)