Closed
Description
What it does
The lint would catch any usage of Permissions::set_readonly
called with false
.set_readonly(false)
on unix platforms sets the file to be world writable - rust-lang/rust#101644
Lint 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 intentional
It's possible that the behaviour will be changed or deprecated upstream before the lint is written
Example
let f = File::create("foo.txt")?;
let metadata = f.metadata()?;
let mut permissions = metadata.permissions();
permissions.set_readonly(false);