Skip to content

Commit 8b2e79d

Browse files
committed
Add test for slice as prefix/suffix pattern
Signed-off-by: Ian Jackson <[email protected]>
1 parent 03b4ea4 commit 8b2e79d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/core/src/slice/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,10 @@ impl<T> [T] {
17831783
/// assert_eq!(v.strip_prefix(&[10, 40]), Some(&[30][..]));
17841784
/// assert_eq!(v.strip_prefix(&[50]), None);
17851785
/// assert_eq!(v.strip_prefix(&[10, 50]), None);
1786+
///
1787+
/// let prefix : &str = "he";
1788+
/// assert_eq!(b"hello".strip_prefix(prefix.as_bytes()),
1789+
/// Some(b"llo".as_ref()));
17861790
/// ```
17871791
#[must_use = "returns the subslice without modifying the original"]
17881792
#[stable(feature = "slice_strip", since = "1.50.0")]

0 commit comments

Comments
 (0)