Skip to content
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

Merged
merged 1 commit into from Jun 7, 2015
Merged

doc: improve some of str examples #25912

merged 1 commit into from Jun 7, 2015

Conversation

tshepang
Copy link
Member

No description provided.

@rust-highfive
Copy link
Collaborator

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");
Copy link
Member

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?

@bluss bluss assigned bluss and unassigned pcwalton Jun 6, 2015
@bluss
Copy link
Member

bluss commented Jun 6, 2015

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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small typo

Copy link
Member Author

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.

@bluss
Copy link
Member

bluss commented Jun 7, 2015

Thank you!

@bluss
Copy link
Member

bluss commented Jun 7, 2015

@bors: r+

@bors
Copy link
Contributor

bors commented Jun 7, 2015

📌 Commit 0335a94 has been approved by bluss

@bors
Copy link
Contributor

bors commented Jun 7, 2015

⌛ Testing commit 0335a94 with merge 8f9f2fe...

@bors bors merged commit 0335a94 into rust-lang:master Jun 7, 2015
@tshepang tshepang deleted the better-str-examples branch June 8, 2015 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants