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

Trailing whitespace in errors #89979

Open
wooster0 opened this issue Oct 17, 2021 · 1 comment
Open

Trailing whitespace in errors #89979

wooster0 opened this issue Oct 17, 2021 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@wooster0
Copy link
Contributor

While working on #89963 I had some issues with my editor automatically trimming trailing whitespace on save when I edited .stderr files so I had to disable that. I don't think any errors should contain trailing whitespace in the first place though. If you search the codebase with regex ^ \| $ you will find tons of such cases.

image

I have the slight feeling that whitespace might just originate from only a single location somewhere in the error printing code so perhaps this is an easy fix and thus probably worth fixing.
A pattern I noticed is that the trailing whitespace pretty much always seems to come at the end of a help: suggestion.

To be fair there's far more whitespace though. If you put src/**/*.stderr in files to include and use \s$ as the regex, you will find even more.

@wooster0 wooster0 added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 17, 2021
@nagisa
Copy link
Member

nagisa commented Oct 17, 2021

You can use ./x.py test --bless to update the test files, rather than editing them manually.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 30, 2021
…=wesleywiser

Refactor EmitterWriter::emit_suggestion_default

Makes progress towards rust-lang#89979

Split into 2 commits:
* the first commit is purely a refactor and I verified that `./x.py test src/test/ui --stage 1` and  `./x.py test src/test/rustdoc-ui --stage 1` continue to pass on this commit.
* ~~the second commit removes the empty trailing line from diff style suggestions.~~ - I discovered an issue with this so its just the refactor now.

r? diagnostics
JohnTitor added a commit to JohnTitor/rust that referenced this issue Nov 30, 2021
…=wesleywiser

Refactor EmitterWriter::emit_suggestion_default

Makes progress towards rust-lang#89979

Split into 2 commits:
* the first commit is purely a refactor and I verified that `./x.py test src/test/ui --stage 1` and  `./x.py test src/test/rustdoc-ui --stage 1` continue to pass on this commit.
* ~~the second commit removes the empty trailing line from diff style suggestions.~~ - I discovered an issue with this so its just the refactor now.

r? diagnostics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants