Mark SlicePattern trait uses as ?Sized

This trait is ?Sized and is often slices.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
Ian Jackson 2020-12-27 01:13:21 +00:00
parent beb293d5df
commit 03b4ea463a

View File

@ -1786,7 +1786,7 @@ impl<T> [T] {
/// ```
#[must_use = "returns the subslice without modifying the original"]
#[stable(feature = "slice_strip", since = "1.50.0")]
pub fn strip_prefix<P: SlicePattern<Item = T>>(&self, prefix: &P) -> Option<&[T]>
pub fn strip_prefix<P: SlicePattern<Item = T> + ?Sized>(&self, prefix: &P) -> Option<&[T]>
where
T: PartialEq,
{
@ -1820,7 +1820,7 @@ impl<T> [T] {
/// ```
#[must_use = "returns the subslice without modifying the original"]
#[stable(feature = "slice_strip", since = "1.50.0")]
pub fn strip_suffix<P: SlicePattern<Item = T>>(&self, suffix: &P) -> Option<&[T]>
pub fn strip_suffix<P: SlicePattern<Item = T> + ?Sized>(&self, suffix: &P) -> Option<&[T]>
where
T: PartialEq,
{