-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Lint permissions.set_readonly(false)
#9702
Comments
Hi, welcome to Clippy! The most direct way would be to take a look at the expression's kind to see if it's an |
It could be, there is https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/consts/fn.constant_simple.html It's not a full const evaluator so it wouldn't be catching |
Added by #10063 |
What it does
The lint would catch any usage of
Permissions::set_readonly
called withfalse
.set_readonly(false)
on unix platforms sets the file to be world writable - rust-lang/rust#101644Lint Name
permissions_set_readonly_false
Category
suspicious
Advantage
The behaviour is surprising, so a lint to inform people that it's probably not doing what they expect would be useful
Drawbacks
If someone knows about that behaviour and is using it intentionally it would be a false positive, however in that case the
#[allow]
would be a good indicator to others that it is intentionalIt's possible that the behaviour will be changed or deprecated upstream before the lint is written
Example
The text was updated successfully, but these errors were encountered: