Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4870,8 +4870,6 @@ impl<T> [T] {
/// # Examples
/// Basic usage:
/// ```
/// #![feature(substr_range)]
///
/// let nums = &[0, 5, 10, 0, 0, 5];
///
/// let mut iter = nums
Expand All @@ -4884,7 +4882,7 @@ impl<T> [T] {
/// assert_eq!(iter.next(), Some(5..6));
/// ```
#[must_use]
#[unstable(feature = "substr_range", issue = "126769")]
#[stable(feature = "substr_range", since = "CURRENT_RUSTC_VERSION")]
pub fn subslice_range(&self, subslice: &[T]) -> Option<Range<usize>> {
if T::IS_ZST {
panic!("elements are zero-sized");
Expand Down
4 changes: 1 addition & 3 deletions library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3099,8 +3099,6 @@ impl str {
///
/// # Examples
/// ```
/// #![feature(substr_range)]
///
/// let data = "a, b, b, a";
/// let mut iter = data.split(", ").map(|s| data.substr_range(s).unwrap());
///
Expand All @@ -3110,7 +3108,7 @@ impl str {
/// assert_eq!(iter.next(), Some(9..10));
/// ```
#[must_use]
#[unstable(feature = "substr_range", issue = "126769")]
#[stable(feature = "substr_range", since = "CURRENT_RUSTC_VERSION")]
pub fn substr_range(&self, substr: &str) -> Option<Range<usize>> {
self.as_bytes().subslice_range(substr.as_bytes())
}
Expand Down
Loading