-
Notifications
You must be signed in to change notification settings - Fork 13.3k
implement rfc 1054: split_whitespace() fn, deprecate words() #24563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Local tests finished successfully. |
Looks good to me! My only concern would be the insta-stabilization of the function, but this is just a renaming of the function so I would be fine stabilizing it (we've done this many times before). Basically r+ from me, but would like to r? @aturon as well. |
r? @aturon |
@@ -1739,27 +1739,50 @@ impl str { | |||
UnicodeStr::grapheme_indices(&self[..], is_extended) | |||
} | |||
|
|||
/// An iterator over the non-empty words of `self`. | |||
/// An iterator over non-whitespace substrings of `self`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What’re non-whitespace substrings?
@nagisa updated documentation to address your comments. Also rebased this branch for good measure. |
@kwantam thanks! LGTM. |
Can you mark the #[stable(feature = "split_whitespace", since = "1.1.0")] since this will be shipping in 1.1, not 1.0? Otherwise, r=me! |
Modified per @aturon's comment. |
/// let some_words = " Mary had\ta little \n\t lamb"; | ||
/// let v: Vec<&str> = some_words.words().collect(); | ||
/// | ||
/// assert_eq!(v, ["Mary", "had", "a", "little", "lamb"]); | ||
/// ``` | ||
#[deprecated(reason = "words() will be removed. Use split_whitespace() instead", | ||
since = "1.0.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be 1.1.0 as well?
@alexcrichton good catch. |
Nominating for the beta milestone to make sure we cherry-pick the destabilization of |
@alexcrichton do you want me to split this into two separate commits to make that easier? |
@kwantam sure! |
Words struct was stabilied by mistake. Unstabilize.
For now, words() is left in (but deprecated), and Words is a type alias for struct SplitWhitespace. Also cleaned up references to s.words() throughout codebase. Closes rust-lang#15628
Let's try that again. f43c86c should applies cleanly against 1.0.0-beta tag. |
@bors: p=1 |
For now, words() is left in (but deprecated), and Words is a type alias for struct SplitWhitespace. Also cleaned up references to str.words() throughout codebase. Closes rust-lang#15628
going from nominated to (nominated, accepted), again on just cherry-picking the destabilization of |
For now, words() is left in (but deprecated), and Words is a type alias for
struct SplitWhitespace.
Also cleaned up references to str.words() throughout codebase.
Closes #15628