Replace custom trim_ascii_start with the standard library method#155134
Conversation
|
r? @mati865 rustbot has assigned @mati865. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| assert_eq!(t, MdTree::UnorderedListItem(vec![MdTree::PlainText("hello")].into())); | ||
| assert_eq!(r, b""); | ||
|
|
||
| // tab after the marker space — needs #[rustfmt::skip] or rustfmt removes it |
There was a problem hiding this comment.
I doubt rustfmt would rewrite string like that and I cannot reproduce the problem, how did you run into that?
There was a problem hiding this comment.
You're right, I actually added the #[rustfmt::skip] out of caution after seeing a note in the tracking issue about rustfmt removing unusual whitespace. But since the tab is written as \t in the string literal (not a literal tab character), rustfmt won't touch it. I'll just remove the attribute.
There was a problem hiding this comment.
Please squash the commit and update the description.
There was a problem hiding this comment.
Please squash the commit and update the description.
@thebabalola do you need help with squashing commits?
@rustbot author
There was a problem hiding this comment.
@teor2345 ... Already done, squashed to 2 commits and force pushed earlier. Thanks for checking..
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
|
@rustbot ready |
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
1fa81a8 to
fdfdb08
Compare
|
@rustbot ready |
|
Great, thanks! @bors r+ |
…-start-with-stdlib, r=mati865 Replace custom trim_ascii_start with the standard library method 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. Fixes rustfoundation/interop-initiative#53
…uwer Rollup of 7 pull requests Successful merges: - #154049 (delegation: Track more precise spans for glob delegations) - #155134 (Replace custom trim_ascii_start with the standard library method) - #155235 (add the `fma4` x86 target feature) - #155218 (coroutines: Skip the closure signature annotation check for tainted bodies) - #155274 (limit duplicate-profiler-builtins test to targets that can do dynamic linking) - #155276 (`#[rustc_must_match_exhaustively]` detect let else) - #155281 (Revert "allow `windows-gnu` targets to embed gdb visualizer scripts")
Rollup merge of #155134 - thebabalola:fix/replace-trim-ascii-start-with-stdlib, r=mati865 Replace custom trim_ascii_start with the standard library method 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. Fixes rustfoundation/interop-initiative#53
The markdown parser in
rustc_errorshas a localtrim_ascii_startfunction 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_liandparse_ordered_li. No behaviour change.I also added a test covering the list item leading-whitespace trimming behaviour, including a tab case.
Fixes rustfoundation/interop-initiative#53