Skip to content

Fix debug string formatting for range formatters - #4936

Open
cuishuang wants to merge 1 commit into
fmtlib:mainfrom
cuishuang:main
Open

Fix debug string formatting for range formatters#4936
cuishuang wants to merge 1 commit into
fmtlib:mainfrom
cuishuang:main

Conversation

@cuishuang

Copy link
Copy Markdown

range_format::debug_string manually added quotes around the result of the underlying string formatter. This bypassed debug string escaping and caused width specifications to exclude the quotes.

For example, newline, quote, and backslash characters were emitted without the expected escaping, and {:8} could produce a result wider than eight columns.

Parse the underlying formatter first, enable its debug format for range_format::debug_string, and delegate formatting directly to it. This ensures that escaping, alignment, and width are handled consistently by the standard string formatter.

Signed-off-by: cuishuang <imcusg@gmail.com>
@cuishuang
cuishuang requested a review from vitaut as a code owner September 7, 2026 04:50
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