Skip to content

chore: replace hand-rolled ascii trim helpers with stabilized std methods#890

Open
immanuwell wants to merge 1 commit into
cloudflare:mainfrom
immanuwell:chore/use-std-trim-ascii
Open

chore: replace hand-rolled ascii trim helpers with stabilized std methods#890
immanuwell wants to merge 1 commit into
cloudflare:mainfrom
immanuwell:chore/use-std-trim-ascii

Conversation

@immanuwell
Copy link
Copy Markdown

@immanuwell immanuwell commented May 27, 2026

Both trim_ascii_start and trim_ascii were stabilized in Rust 1.80, and
the project MSRV is 1.84 - so we can drop the hand-rolled copies.

conditional_filter.rs had a local trim_ascii_start fn with a TODO
comment pointing at the stdlib method that was (then) unstable:

// TODO: use `trim_ascii_start` when it stabilizes
fn trim_ascii_start(mut bytes: &[u8]) -> &[u8] { ... }

compression/mod.rs had the same pattern inline with a comment:

// This is equivalent to slice.trim_ascii() which is unstable
while let [first, rest @ ..] = v { ... }
while let [rest @ .., last] = v { ... }

Both replaced with the one-liner stdlib calls. No behavior change, all
existing tests pass.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant