Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better (shorter, clearer) debug implementation #58

Closed
wants to merge 1 commit into from

Conversation

tailhook
Copy link
Contributor

Fixes #56

Note: apart from what is discussed here I've also included \0 escape. In Rust this is not an octal escape but a special case similar to \n and \t. Given that it's quite often used in binary data, and is shorter this way, I think it justifies the special case.

BurntSushi pushed a commit that referenced this pull request Oct 18, 2020
Previously, any non-printable Unicode scalar value would get printed
using the '\u{...}' syntax. While not horrible, it's a bit weird to
do this for ASCII characters and especially for the NUL and various
whitespace characters. So this commit tweaks the Debug impl for BStr to
handle those cases specially in a way that's a bit more consistent with
what folks expect.

Fixes #56, Closes #58
@tailhook tailhook deleted the better_debug branch October 19, 2020 10:07
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 27, 2022
Bump the ripgrep commit exercised by cargotest

This update goes from BurntSushi/ripgrep@3de31f7 (Aug 1, 2019) to current master, BurntSushi/ripgrep@ced5b92 (March 21, 2022).

I need this in order to pick up BurntSushi/ripgrep#1722, which picked up BurntSushi/bstr#58, which unblocks rust-lang#95345. Ripgrep uses the Debug representation of a `BStr` in some of its tests. In old versions of bstr, that used to just use the standard library's `escape_debug()` implementation, so the output ends up being sensitive to whether the standard library renders character 0 as `\u{0}` or as `\0`. The newer bstr always renders character 0 as `\0` and ripgrep's test suite has been correspondingly updated.
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.

More compatible escapes for control characters
1 participant