-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
doc: improve some of str examples #25912
Conversation
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -1195,6 +1177,7 @@ impl str { | |||
/// | |||
/// ``` | |||
/// assert_eq!("11foo1bar11".trim_matches('1'), "foo1bar"); | |||
/// assert_eq!("123foo1bar123".trim_matches(|c: char| c.is_numeric()), "foo1bar"); |
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.
this could be char::is_numeric
too?, just like the split example?
I like the new formulations, it should be friendlier to read. r=me with the nit fixed for consistency |
@@ -1494,7 +1472,7 @@ impl str { | |||
/// ``` | |||
/// let s = "Löwe 老虎 Léopard"; | |||
/// | |||
/// assert_eq!(s.find(|c: char| c.is_whitespace()), Some(5)); | |||
/// assert_eq!(s.find(cahr::is_whitespace), Some(5)); |
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.
small typo
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.
Sorry, it's fixed now. I meant only to ping you once the tests passed.
You may have noticed that this is one example of removing some more needless usage of closures.
Thank you! |
@bors: r+ |
📌 Commit 0335a94 has been approved by |
No description provided.