Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add suspicious_open_options lint. #11608
Add suspicious_open_options lint. #11608
Changes from all commits
6c201db
6fb471d
2ec8729
84588a8
515fe65
f09cd88
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this change, using a map instead of the code duplication with locals 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can have a help message here? Something like
Even better if it has a proper suggestion, but just a simple help message works too. For that we could use
span_lint_and_then
to add help messages to the diagnosticThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea. I have changed to add a better help message. I did spend some time trying to add a suggestion, but despite spending an hour on it, I could not make it work.
cargo test
seems to output the right suggestion, trying to runcargo bless
generates the right stuff in the.fixed
file, but still fails, and so doescargo test
afterwards. I just get a crypticrustfix failed with exit status: 1
.Happy to hear your suggestions (ahah), or if you feel like uncommenting the one line and making it work...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggestion looked good to me (I think you removed them in the last commit?). I believe the problem with the test is that we can't generally mix warnings that have suggestions with warnings that don't in the same file.
In this case, uitest recognizes that there are warnings with suggestions, so it creates a
.fixed
file with those suggestions applied, but the other lines will still emit a warning in the.fixed
file, which it then rejects.We can fix this by moving the tests with a suggestion to its own file (e.g.
open_options_fixable.rs
, orsuspicious_open_options.rs
)