-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
FIX - Char documentation for unexperienced users #72371
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @LukasKalbertodt (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
84f6b61
to
f5b4957
Compare
@lcnr Thanks for the review, I've fixed :) |
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.
Looks good to me, thanks so much!
@bors: r+ rollup |
📌 Commit f5b4957 has been approved by |
…eklabnik FIX - Char documentation for unexperienced users This is my first PR on rust and even if I've read [CONTRIBUTING.md](https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#pull-requests) I'm ensure everything is perfect. Sorry if I didn't follow the exact procedure. **What it does:** - Add an example in the char documentation **Explanation** Unexperienced users might not know that punctuation is `Case_Ignorable` and not `Uppercase` and `Lowercase` which mean that when checking if a string is uppercase one might be tempted to write: ```rust my_string.chars().all(char::is_uppercase) ``` However this will return false for `"HELLO WORLD"` which is not intuitive. Since the function `is_case_ignorable` doesn't exists I believe the correct way to check is: ```rust !my_string.chars().any(char::is_lowercase) ``` The aim of this example is to prevent unexperienced users to make an error which punctuation chars.
Rollup of 7 pull requests Successful merges: - rust-lang#71854 (Make `std::char` functions and constants associated to `char`.) - rust-lang#72111 (rustc-book: Document `-Z strip=val` option) - rust-lang#72272 (Fix going back in history to a search result page on firefox) - rust-lang#72296 (Suggest installing VS Build Tools in more situations) - rust-lang#72365 (Remove unused `StableHashingContext::node_to_hir_id` method) - rust-lang#72371 (FIX - Char documentation for unexperienced users) - rust-lang#72397 (llvm: Expose tiny code model to users) Failed merges: r? @ghost
This is my first PR on rust and even if I've read CONTRIBUTING.md I'm ensure everything is perfect. Sorry if I didn't follow the exact procedure.
What it does:
Explanation
Unexperienced users might not know that punctuation is
Case_Ignorable
and notUppercase
andLowercase
which mean that when checking if a string is uppercase one might be tempted to write:However this will return false for
"HELLO WORLD"
which is not intuitive. Since the functionis_case_ignorable
doesn't exists I believe the correct way to check is:The aim of this example is to prevent unexperienced users to make an error which punctuation chars.