diff options
| author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2020-08-03 01:06:11 +0100 |
|---|---|---|
| committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2020-10-12 14:48:07 +0100 |
| commit | b7974bd3cd2df94d19dad467fa09a79f78067559 (patch) | |
| tree | 8f1ae89663dd761ea5efb884ca4f657d52cb1b32 | |
| parent | dbb058302388824b717816b42bbfbc00330fa36d (diff) | |
| download | rust-b7974bd3cd2df94d19dad467fa09a79f78067559.tar.gz rust-b7974bd3cd2df94d19dad467fa09a79f78067559.zip | |
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>
| -rw-r--r-- | library/core/src/slice/mod.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index d0d88c01f5b..1dfe899d3e5 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -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 /// |
