Skip to content

Commit d4e5418

Browse files
authored
Rollup merge of #104774 - vojtechkral:doc-str-empty-split-whitespace, r=thomcc
Document split{_ascii,}_whitespace() for empty strings doc change only
2 parents 9a558b6 + 07ccf67 commit d4e5418

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

library/core/src/str/mod.rs

+12
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,12 @@ impl str {
902902
///
903903
/// assert_eq!(None, iter.next());
904904
/// ```
905+
///
906+
/// If the string is empty or all whitespace, the iterator yields no string slices:
907+
/// ```
908+
/// assert_eq!("".split_whitespace().next(), None);
909+
/// assert_eq!(" ".split_whitespace().next(), None);
910+
/// ```
905911
#[must_use = "this returns the split string as an iterator, \
906912
without modifying the original"]
907913
#[stable(feature = "split_whitespace", since = "1.1.0")]
@@ -946,6 +952,12 @@ impl str {
946952
///
947953
/// assert_eq!(None, iter.next());
948954
/// ```
955+
///
956+
/// If the string is empty or all ASCII whitespace, the iterator yields no string slices:
957+
/// ```
958+
/// assert_eq!("".split_ascii_whitespace().next(), None);
959+
/// assert_eq!(" ".split_ascii_whitespace().next(), None);
960+
/// ```
949961
#[must_use = "this returns the split string as an iterator, \
950962
without modifying the original"]
951963
#[stable(feature = "split_ascii_whitespace", since = "1.34.0")]

0 commit comments

Comments
 (0)