Skip to content

Replace custom trim_ascii_start with the standard library method#155134

Open
thebabalola wants to merge 2 commits intorust-lang:mainfrom
thebabalola:fix/replace-trim-ascii-start-with-stdlib
Open

Replace custom trim_ascii_start with the standard library method#155134
thebabalola wants to merge 2 commits intorust-lang:mainfrom
thebabalola:fix/replace-trim-ascii-start-with-stdlib

Conversation

@thebabalola
Copy link
Copy Markdown

The markdown parser in rustc_errors has a local trim_ascii_start function that strips leading ASCII whitespace from a byte slice. The standard library has had <[u8]>::trim_ascii_start() since Rust 1.80, which does the same thing.

This PR removes the custom function and calls the stdlib method directly in parse_unordered_li and parse_ordered_li. No behaviour change.

I also added a test covering the list item leading-whitespace trimming behaviour, including a tab case (with #[rustfmt::skip]).

Fixes rustfoundation/interop-initiative#53

The local trim_ascii_start function in the markdown parser duplicates
<[u8]>::trim_ascii_start() from the standard library (stable since 1.80).
Remove the custom function and call the stdlib method directly.

No behaviour change.

Fixes rustfoundation/interop-initiative#53
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 10, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 10, 2026

r? @mati865

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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 11 candidates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Outreachy tracking issue for Rust whitespace check bugs

3 participants