mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-28 03:07:24 +03:00
98e7077b90
core: respect precision in `ByteStr` `Display` Fixes rust-lang/rust#153022. `ByteStr`'s `Display` implementation didn't respect the precision parameter. Just like `Formatter::pad`, this is fixed by counting off the characters in the string and truncating after the requested length – with the added complication that the `ByteStr` needs to be divided into chunks first. By including a fast path that avoids counting the characters when no parameters were specified this should also fix the performance regressions caused by rust-lang/rust#152865.