docs: slice::strip_prefix and strip_suffix, fold in sentence

Roughly as requested by @LukasKalbertodt.  I still prefer clearly
making these two cases.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
Ian Jackson 2020-10-12 12:46:17 +01:00
parent 6f5e96fb5f
commit 22358c650b

View File

@ -1704,11 +1704,10 @@ impl<T> [T] {
/// Returns a subslice with the prefix removed.
///
/// If the slice starts with `prefix`, returns the subslice after the prefix, wrapped in `Some`.
/// If `prefix` is empty, simply returns the original slice.
///
/// If the slice does not start with `prefix`, returns `None`.
///
/// (If `prefix` is empty, simply returns the original slice.)
///
/// # Examples
///
/// ```
@ -1738,11 +1737,10 @@ impl<T> [T] {
/// Returns a subslice with the suffix removed.
///
/// If the slice ends with `suffix`, returns the subslice before the suffix, wrapped in `Some`.
/// If `suffix` is empty, simply returns the original slice.
///
/// If the slice does not end with `suffix`, returns `None`.
///
/// (If `suffix` is empty, simply returns the original slice.)
///
/// # Examples
///
/// ```