-
Notifications
You must be signed in to change notification settings - Fork 898
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
Trailing whitespaces are stripped in raw string literals in doc tests #5978
Comments
This issue only exists in doc comments. Trailing spaces in raw string literals are kept correctly in regular code |
@Pistonight thanks for the report. Generally, rustfmt does it's best to remove trailing whitespace, but I understand in this case it's changing the semantics of the code in the doc test. If possible, I'd encourage you to write your doc test in a way that avoids trailing whitespace. I did a little investigating into what's going on. Hopefully this will be useful for anyone if they decide to work on this: In this particular case code execution is going to Line 374 in 2174e60
Code execution continues on to Line 1081 in 2174e60
I thought that configuring rustfmt with Lines 376 to 383 in 2174e60
and again we end up calling Lines 922 to 933 in 2174e60
|
Example:
Note that the expected string has a space before the last newline.
cargo fmt
strips the space in the raw string literal, causing passing doc tests to fail afterwardsThe text was updated successfully, but these errors were encountered: