Skip to content

Add ASCII whitespace trimming functions to &str #118523

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

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

okaneco
Copy link
Contributor

@okaneco okaneco commented Dec 2, 2023

  • Add trim_ascii_start, trim_ascii_end, and trim_ascii functions to &str for trimming ASCII whitespace
  • Add #[inline] to [u8] trim_ascii functions

These functions are feature-gated by #![feature(byte_slice_trim_ascii)] #94035

@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2023

r? @Mark-Simulacrum

(rustbot has picked a reviewer for you, use r? to override)

@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 Dec 2, 2023
@rust-log-analyzer

This comment has been minimized.

@Mark-Simulacrum Mark-Simulacrum added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed 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 Dec 9, 2023
@Mark-Simulacrum
Copy link
Member

Marking as waiting on team, since there's no T-libs-api ACP or other sign off for this new unstable surface area.

@okaneco
Copy link
Contributor Author

okaneco commented Dec 9, 2023

Filed an ACP
rust-lang/libs-team#313

I didn't initially file one because the dev guide made it seem more optional than required.

@joshtriplett
Copy link
Member

Discussed in today's @rust-lang/libs-api meeting, and we decided to accept these. We can evaluate further during stabilization.

@m-ou-se
Copy link
Member

m-ou-se commented Dec 12, 2023

It's probably best to use the same tracking issue as for the [u8] methods.

Add `trim_ascii_start`, `trim_ascii_end`, and `trim_ascii` functions to
`&str` for trimming ASCII whitespace under the `byte_slice_trim_ascii`
feature gate.
Add `inline` to `[u8]` `trim_ascii` functions
@okaneco
Copy link
Contributor Author

okaneco commented Dec 12, 2023

Put these functions under the [u8] feature.
Added inline annotations to &str and [u8] functions.

@okaneco
Copy link
Contributor Author

okaneco commented Dec 12, 2023

@rustbot label -S-waiting-on-team +S-waiting-on-review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Dec 12, 2023
@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 16, 2023

📌 Commit e4808af has been approved by Mark-Simulacrum

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 Dec 16, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 16, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…kingjubilee

Rollup of 6 pull requests

Successful merges:

 - rust-lang#118523 (Add ASCII whitespace trimming functions to `&str`)
 - rust-lang#118851 ([std] Add xcoff in object's feature list)
 - rust-lang#118989 (Simplify lint decorator derive too)
 - rust-lang#118993 (use `if cfg!` instead of `#[cfg]`)
 - rust-lang#119003 (NFC: do not clone types that are copy)
 - rust-lang#119004 (NFC don't convert types to identical types)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 15e84eb into rust-lang:master Dec 16, 2023
@rustbot rustbot added this to the 1.76.0 milestone Dec 16, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 16, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Rollup merge of rust-lang#118523 - okaneco:trim_ascii, r=Mark-Simulacrum

Add ASCII whitespace trimming functions to `&str`

- Add `trim_ascii_start`, `trim_ascii_end`, and `trim_ascii` functions to `&str` for trimming ASCII whitespace
- Add `#[inline]` to `[u8]` `trim_ascii` functions

These functions are feature-gated by `#![feature(byte_slice_trim_ascii)]` rust-lang#94035
@okaneco okaneco deleted the trim_ascii branch December 16, 2023 07:35
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-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants