summary refs log tree commit diff
path: root/src/libcore/char
AgeCommit message (Collapse)AuthorLines
2020-05-30encode_utf8_raw is not always valid UTF-8; clarify commentsRalf Jung-7/+12
2020-05-30also expose and use encode_utf16_raw for wtf8Ralf Jung-22/+39
2020-05-30expose char::encode_utf8_raw for libstdRalf Jung-40/+63
2020-05-28from_u32_unchecked: check validity when debug assertions are enabledRalf Jung-2/+2
2020-05-21Rollup merge of #72371 - Elrendio:char_documentation, r=steveklabnikRalf Jung-2/+4
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.
2020-05-20FIX - Char documentation for unexperienced usersElrendio-2/+4
2020-05-03Try to fix doc links in new `char` methods.Eduardo Sánchez Muñoz-16/+13
2020-05-03Make `std::char` functions and constants associated to `char`.Eduardo Sánchez Muñoz-2/+242
2020-04-23Stabilize UNICODE_VERSION (feature unicode_version)Pyfisch-3/+1
The feature will become stable in Rust 1.45. Noted that the value of UNICODE_VERSION is expected to change.
2020-04-11Store UNICODE_VERSION as a tuplePyfisch-2/+0
Remove the UnicodeVersion struct containing major, minor and update fields and replace it with a 3-tuple containing the version number. As the value of each field is limited to 255 use u8 to store them.
2020-02-11Improve `char::is_ascii_*` codeAndrea Canciani-10/+40
These methods explicitly check if a char is in a specific ASCII range, therefore the `is_ascii()` check is not needed, but LLVM seems to be unable to remove it. WARNING: this change improves the performance on ASCII `char`s, but complex checks such as `is_ascii_punctuation` become slower on non-ASCII `char`s.
2020-02-08Make the ASCII ctype inherent methods constDylan MacKenzie-10/+20
2020-01-14Replace old tables with new unicode dataMark Rousskov-10/+10
2019-12-23Minimize unsafety in encode_utf8Mark Rousskov-30/+29
Use slice patterns to avoid having to skip bounds checking
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-1/+1
2019-12-18Propagate cfg bootstrapMark Rousskov-4/+1
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-0/+4
functions with a `const` modifier
2019-12-11Some small readability improvementsAndre Bogus-10/+5
2019-11-26Format libcore with rustfmtDavid Tolnay-83/+57
This commit applies rustfmt with default settings to files in src/libcore *that are not involved in any currently open PR* to minimize merge conflicts. The list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in `outstanding_files`, the relevant commands were: $ find src/libcore -name '*.rs' | xargs rustfmt --edition=2018 $ rg libcore outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libcore.
2019-11-06Have tidy ensure that we document all `unsafe` blocks in libcoreOliver Scherer-1/+5
2019-10-12Improve docs on some char boolean methodsBO41-63/+109
2019-10-01Remove unneeded `fn main` blocks from docsLzu Tao-34/+32
2019-09-04remove XID and Pattern_White_Space unicode tables from libcoreAleksey Kladov-23/+0
They are only used by rustc_lexer, and are not needed elsewhere. So we move the relevant definitions into rustc_lexer (while the actual unicode data comes from the unicode-xid crate) and make the rest of the compiler use it.
2019-08-14Handle cfg(bootstrap) throughoutMark Rousskov-12/+2
2019-07-25Fix inconsistent highlight blocks.Tomasz Różański-7/+7
2019-07-22add rustc_private as a proper language feature gateAleksey Kladov-7/+12
At the moment, `rustc_private` as a (library) feature exists by accident: `char::is_xid_start`, `char::is_xid_continue` methods in libcore define it.
2019-06-30fix the same typo in doctestlcolaholicl-2/+2
2019-06-30Fix a typolcolaholicl-1/+1
Fix a typo in `libcore/char/methods.rs`
2019-06-14Change `...` to `..=` where applicableAaron Kutch-18/+18
2019-04-19libcore: deny more...Mazdak Farrokhzad-10/+9
2019-04-18libcore => 2018Taiki Endo-13/+16
2019-03-19Rollup merge of #58778 - xfix:exact_size_case_mapping_iter, r=SimonSapinMazdak Farrokhzad-0/+22
Implement ExactSizeIterator for ToLowercase and ToUppercase
2019-03-19Update since annotation for ExactSizeIterator for ToUppercase/LowercaseKonrad Borowski-2/+2
This functionality was added in 1.35.0, not 1.34.0.
2019-02-27Implement ExactSizeIterator for ToLowercase and ToUppercaseKonrad Borowski-0/+22
2019-02-13Stabilize TryFrom and TryIntoSimon Sapin-4/+4
2019-02-12Auto merge of #58051 - SimonSapin:str_escape, r=alexcrichtonbors-3/+1
Stabilize str::escape_* methods with new return types… … that implement `Display` and `Iterator<Item=char>`, as proposed in FCP: https://github.com/rust-lang/rust/issues/27791#issuecomment-376864727
2019-02-12Make the prema-unstable char::escape_debug_ext method crate-privateSimon Sapin-3/+1
2019-02-10libs: doc commentsAlexander Regueiro-11/+11
2018-12-25Remove licensesMark Rousskov-40/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-11-21update various stdlib docsSteve Klabnik-4/+2
2018-11-14core/char: Add comment to `to_digit()`Tobias Bieniek-0/+3
2018-11-14core/char: Drop `radix == 10` special caseTobias Bieniek-8/+1
This seems to perform equally well
2018-11-13core/char: Speed up `to_digit()` for `radix <= 10`Tobias Bieniek-5/+20
### Before ``` # Run 1 test char::methods::bench_to_digit_radix_10 ... bench: 16,265 ns/iter (+/- 1,774) test char::methods::bench_to_digit_radix_16 ... bench: 13,938 ns/iter (+/- 2,479) test char::methods::bench_to_digit_radix_2 ... bench: 13,090 ns/iter (+/- 524) test char::methods::bench_to_digit_radix_36 ... bench: 14,236 ns/iter (+/- 1,949) # Run 2 test char::methods::bench_to_digit_radix_10 ... bench: 16,176 ns/iter (+/- 1,589) test char::methods::bench_to_digit_radix_16 ... bench: 13,896 ns/iter (+/- 3,140) test char::methods::bench_to_digit_radix_2 ... bench: 13,158 ns/iter (+/- 1,112) test char::methods::bench_to_digit_radix_36 ... bench: 14,206 ns/iter (+/- 1,312) # Run 3 test char::methods::bench_to_digit_radix_10 ... bench: 16,221 ns/iter (+/- 2,423) test char::methods::bench_to_digit_radix_16 ... bench: 14,361 ns/iter (+/- 3,926) test char::methods::bench_to_digit_radix_2 ... bench: 13,097 ns/iter (+/- 671) test char::methods::bench_to_digit_radix_36 ... bench: 14,388 ns/iter (+/- 1,068) ``` ### After ``` # Run 1 test char::methods::bench_to_digit_radix_10 ... bench: 11,521 ns/iter (+/- 552) test char::methods::bench_to_digit_radix_16 ... bench: 12,926 ns/iter (+/- 684) test char::methods::bench_to_digit_radix_2 ... bench: 11,266 ns/iter (+/- 1,085) test char::methods::bench_to_digit_radix_36 ... bench: 14,213 ns/iter (+/- 614) # Run 2 test char::methods::bench_to_digit_radix_10 ... bench: 11,424 ns/iter (+/- 1,042) test char::methods::bench_to_digit_radix_16 ... bench: 12,854 ns/iter (+/- 1,193) test char::methods::bench_to_digit_radix_2 ... bench: 11,193 ns/iter (+/- 716) test char::methods::bench_to_digit_radix_36 ... bench: 14,249 ns/iter (+/- 3,514) # Run 3 test char::methods::bench_to_digit_radix_10 ... bench: 11,469 ns/iter (+/- 685) test char::methods::bench_to_digit_radix_16 ... bench: 12,852 ns/iter (+/- 568) test char::methods::bench_to_digit_radix_2 ... bench: 11,275 ns/iter (+/- 1,356) test char::methods::bench_to_digit_radix_36 ... bench: 14,188 ns/iter (+/- 1,501) ```
2018-11-13core/char: Replace condition + `panic!()` with `assert!()`Tobias Bieniek-3/+1
2018-11-10reduce list to functions callable in const ctx.Mazdak Farrokhzad-1/+1
2018-11-10constify parts of libcore.Mazdak Farrokhzad-2/+2
2018-09-25Add examples for docSon-4/+22
2018-08-20Add doc for impl From in char_convertSon-0/+8
2018-08-12Rollup merge of #53059 - ljedrz:unneeded_returns, r=kennytmGuillaume Gomez-2/+2
Remove explicit returns where unnecessary