Skip to content

Commit

Permalink
Rollup merge of #104774 - vojtechkral:doc-str-empty-split-whitespace,…
Browse files Browse the repository at this point in the history
… r=thomcc

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

doc change only
  • Loading branch information
Dylan-DPC authored Nov 24, 2022
2 parents ca5e9ad + 9a2b955 commit 294441e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,12 @@ impl str {
///
/// 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")]
Expand Down Expand Up @@ -946,6 +952,12 @@ impl str {
///
/// assert_eq!(None, iter.next());
/// ```
///
/// If the string is empty or all ASCII 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_ascii_whitespace", since = "1.34.0")]
Expand Down

0 comments on commit 294441e

Please sign in to comment.