pingora icon indicating copy to clipboard operation
pingora copied to clipboard

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

Open immanuwell opened this issue 6 months ago • 0 comments

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.

immanuwell avatar May 27 '26 14:05 immanuwell