Skip to content

Add "chr" as doc alias to char::from_u32 #80431

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Dec 29, 2020

Conversation

LunaBorowska
Copy link
Contributor

@LunaBorowska LunaBorowska commented Dec 28, 2020

Many programming languages provide a function called chr - Perl, Python, PHP, Visual Basic, SQL. This change makes char::from_u32 easier to discover in the documentation.

ord is not added as its name conflicts with Ord trait, and it's not exactly clear what it could point to (<u32 as From<char>>::from?). I don't think it's exactly necessary, as char::from_u32 documentation page says you can do reverse conversion with as operator anyway.

@rust-highfive
Copy link
Contributor

r? @m-ou-se

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 28, 2020
@pickfire
Copy link
Contributor

Why from_u32 and not from_digit too?

@LunaBorowska
Copy link
Contributor Author

LunaBorowska commented Dec 28, 2020

Why from_u32 and not from_digit too?

char::from_digit has nothing to do with chr function in various programming languages.

@steveklabnik
Copy link
Member

Yep, this is great, thanks a ton!

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 28, 2020

📌 Commit b3be9e1 has been approved by steveklabnik

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 28, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 29, 2020
Rollup of 11 pull requests

Successful merges:

 - rust-lang#80383 (clarify wrapping ptr arithmetic docs)
 - rust-lang#80390 (BTreeMap: rename the area access methods)
 - rust-lang#80393 (Add links to the source for the rustc and rustdoc books.)
 - rust-lang#80398 (Use raw version of align_of in rc data_offset)
 - rust-lang#80402 (Document `InferTy` & co.)
 - rust-lang#80403 (fix: small typo error in chalk/mod.rs)
 - rust-lang#80410 (rustdoc book: fix example)
 - rust-lang#80419 (Add regression test for rust-lang#80375)
 - rust-lang#80430 (Add "length" as doc alias to len methods)
 - rust-lang#80431 (Add "chr" as doc alias to char::from_u32)
 - rust-lang#80448 (Fix stabilization version of deque_range feature.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5a08162 into rust-lang:master Dec 29, 2020
@rustbot rustbot added this to the 1.51.0 milestone Dec 29, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants