Skip to content

Conversation

timvisee
Copy link
Contributor

@timvisee timvisee commented Oct 16, 2025

Update the description of the is_ascii functions - an empty string or slice also returns true.

This follows the pattern of all(). Clippy currently suggests to change string.chars().all(|c| c.is_ascii()) into string.is_ascii(). This suggestion therefore seems fitting.

I've already questioned the behavior for this multiple times. I've always had to check the internals to conclude how it works. That's why I'm opening this PR to add it directly in the documentation.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 16, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 16, 2025

r? @joboet

rustbot has assigned @joboet.
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

@Noratrieb
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Oct 16, 2025

📌 Commit 7a11c72 has been approved by Noratrieb

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 16, 2025
bors added a commit that referenced this pull request Oct 16, 2025
Rollup of 9 pull requests

Successful merges:

 - #144438 (Guard HIR lowered contracts with `contract_checks`)
 - #147000 (std: Add Motor OS std library port)
 - #147576 (Fix ICE on offsetted ZST pointer)
 - #147732 (remove duplicate inline macro)
 - #147738 (Don't highlight `let` expressions as having type `bool` in let-chain error messages)
 - #147744 (miri subtree update)
 - #147751 (Use `bit_set::Word` in a couple more places.)
 - #147752 (style-guide: fix typo for empty struct advice)
 - #147773 (`is_ascii` on an empty string or slice returns true)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f337e28 into rust-lang:master Oct 16, 2025
11 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 16, 2025
rust-timer added a commit that referenced this pull request Oct 16, 2025
Rollup merge of #147773 - timvisee:docs-empty-is-ascii, r=Noratrieb

`is_ascii` on an empty string or slice returns true

Update the description of the [`is_ascii`](https://doc.rust-lang.org/std/primitive.str.html#method.is_ascii) functions - an empty string or slice also returns `true`.

This follows the pattern of [`all()`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.all). Clippy currently suggests to change `string.chars().all(|c| c.is_ascii())` into `string.is_ascii()`. This suggestion therefore seems fitting.

I've already questioned the behavior for this multiple times. I've always had to check the internals to conclude how it works. That's why I'm opening this PR to add it directly in the documentation.
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-libs Relevant to the library 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