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

rustdoc: improve <wbr>-insertion for SCREAMING_CAMEL_CASE #131370

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

notriddle
Copy link
Contributor

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Oct 7, 2024

r? @GuillaumeGomez

rustbot has assigned @GuillaumeGomez.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Oct 7, 2024
@@ -24,6 +24,7 @@ fn escape_body_text_with_wbr() {
assert_eq!(&E("first:second").to_string(), "first:<wbr>second");
assert_eq!(&E("first::second").to_string(), "first::<wbr>second");
assert_eq!(&E("MY_CONSTANT").to_string(), "MY_<wbr>CONSTANT");
assert_eq!(&E("_SIDD_MASKED_NEGATIVE_POLARITY").to_string(), "_SIDD_<wbr>MASKED_<wbr>NEGATIVE_<wbr>POLARITY");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This sample is pulled from core/arch, and before this patch it was written _SID<wbr>D_<wbr>MASKE<wbr>D_<wbr>NEGATIV<wbr>E_<wbr>POLARITY which is clearly worse.

@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the notriddle/screaming-camel-case branch from 24cbbf9 to e23419f Compare October 7, 2024 17:52
@@ -108,7 +108,7 @@ impl<'a> fmt::Display for EscapeBodyTextWithWbr<'a> {
|| pk.map_or(true, |(_, t)| t.chars().any(|c| c.is_uppercase()));
let next_is_underscore = || pk.map_or(true, |(_, t)| t.contains('_'));
let next_is_colon = || pk.map_or(true, |(_, t)| t.contains(':'));
if i - last > 3 && is_uppercase() && !next_is_uppercase() {
if i - last > 3 && is_uppercase() && !next_is_uppercase() && !next_is_underscore() {
Copy link
Member

Choose a reason for hiding this comment

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

I think this code is now complex enough to deserve a small comment (at least on this if) to explain what it's checking (with some examples to make it even simpler).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. No problem.

Copy link
Member

Choose a reason for hiding this comment

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

Awesome, thanks!

@GuillaumeGomez
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 7, 2024

📌 Commit f7eced3 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@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 Oct 7, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Oct 7, 2024
…l-case, r=GuillaumeGomez

rustdoc: improve `<wbr>`-insertion for SCREAMING_CAMEL_CASE
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 7, 2024
…llaumeGomez

Rollup of 4 pull requests

Successful merges:

 - rust-lang#130824 (Add missing module flags for `-Zfunction-return=thunk-extern`)
 - rust-lang#131170 (Fix `target_vendor` in non-IDF Xtensa ESP32 targets)
 - rust-lang#131369 (Update books)
 - rust-lang#131370 (rustdoc: improve `<wbr>`-insertion for SCREAMING_CAMEL_CASE)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 8, 2024
Rollup of 7 pull requests

Successful merges:

 - rust-lang#130824 (Add missing module flags for `-Zfunction-return=thunk-extern`)
 - rust-lang#131170 (Fix `target_vendor` in non-IDF Xtensa ESP32 targets)
 - rust-lang#131355 (Add tests for some old fixed issues)
 - rust-lang#131369 (Update books)
 - rust-lang#131370 (rustdoc: improve `<wbr>`-insertion for SCREAMING_CAMEL_CASE)
 - rust-lang#131379 (Fix utf8-bom test)
 - rust-lang#131385 (Un-vacation myself)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ad96cf3 into rust-lang:master Oct 8, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Oct 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 8, 2024
Rollup merge of rust-lang#131370 - notriddle:notriddle/screaming-camel-case, r=GuillaumeGomez

rustdoc: improve `<wbr>`-insertion for SCREAMING_CAMEL_CASE
@notriddle notriddle deleted the notriddle/screaming-camel-case branch October 8, 2024 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants