Rollup merge of #104774 - vojtechkral:doc-str-empty-split-whitespace, r=thomcc

Document split{_ascii,}_whitespace() for empty strings

doc change only
This commit is contained in:
Matthias Krüger 2022-11-24 21:34:54 +01:00 committed by GitHub
commit d4e5418b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -902,6 +902,12 @@ pub fn bytes(&self) -> Bytes<'_> {
///
/// assert_eq!(None, iter.next());
/// ```
///
/// If the string is empty or all whitespace, the iterator yields no string slices:
/// ```
/// assert_eq!("".split_whitespace().next(), None);
/// assert_eq!(" ".split_whitespace().next(), None);
/// ```
#[must_use = "this returns the split string as an iterator, \
without modifying the original"]
#[stable(feature = "split_whitespace", since = "1.1.0")]
@ -946,6 +952,12 @@ pub fn split_whitespace(&self) -> SplitWhitespace<'_> {
///
/// assert_eq!(None, iter.next());
/// ```
///
/// If the string is empty or all ASCII whitespace, the iterator yields no string slices:
/// ```
/// assert_eq!("".split_ascii_whitespace().next(), None);
/// assert_eq!(" ".split_ascii_whitespace().next(), None);
/// ```
#[must_use = "this returns the split string as an iterator, \
without modifying the original"]
#[stable(feature = "split_ascii_whitespace", since = "1.34.0")]