Fix false positive in suspicious_open_options
and make paths work
#1
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.
Implements the last few things I had in mind for rust-clippy#11608
This already looked pretty good. The fix for the false positive I had mentioned was basically 90% done. Only the matching needed to be fixed and some paths were incorrect.
Summarising my changes:
no_run
. At some point in the last months (after this branched off master) a change was made that changed the default test mode tono_run
, because almost all of the doc tests don't need to be run (only compiled).tokio::fs::OpenOptions
, but clippy's path methods compare them to the path where they're defined. The real definition path istokio::fs::open_options::OpenOptions
.OpenOptions::new()
call in the chain workRegarding
This is a case where it's ok to lint, but we currently aren't because it requires tracking calls across statements. I think it's doable, but imo we could/should land it as is with that false negative and fix that as a followup.
In particular, we'd need to be careful here because of control flow. For example:
... shouldn't be linted since that conditionally overwrites it (and a few other cases).