docs: Reword slice::strip_prefix and strip_suffix a bit

The stabilisation issue, #73413, has an open item for documentation.
I looked at the docs and it is all there, but I felt it could do with
some minor wording improvement.

I looked at the `str::strip_prefix` docs for a template.  (That
resulted in me slightly changing that doc too.)

I de-linkified `None` and `Some`, as I felt that rather noisy..  I
searched stdlib, and these don't seem to be usually linkified.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
Ian Jackson 2020-08-03 01:06:11 +01:00
parent dbb0583023
commit b7974bd3cd

View File

@ -1703,8 +1703,12 @@ impl<T> [T] {
/// Returns a subslice with the prefix removed.
///
/// This method returns [`None`] if slice does not start with `prefix`.
/// Also it returns the original slice if `prefix` is an empty slice.
/// If the slice starts with `prefix`, returns
/// the subslice after the prefix, wrapped in `Some`.
///
/// If the slice does not start with `prefix`, returns `None`.
///
/// (If `prefix` is empty, simply returns the original slice.)
///
/// # Examples
///
@ -1734,8 +1738,12 @@ impl<T> [T] {
/// Returns a subslice with the suffix removed.
///
/// This method returns [`None`] if slice does not end with `suffix`.
/// Also it returns the original slice if `suffix` is an empty slice
/// If the slice ends with `suffix`, returns
/// the subslice before the suffix, wrapped in `Some`.
///
/// If the slice does not end with `suffix`, returns `None`.
///
/// (If `suffix` is empty, simply returns the original slice.)
///
/// # Examples
///