You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This lint would warn when a user uses std::fs::OpenOptions or tokio::fs::OpenOptions and calls both write and append
Lint Name
no_write_and_append
Category
correctness, suspicious, pedantic
Advantage
Remove write call that doesn't have any affect
Drawbacks
Some people might do this deliberately to highlight that writes are enabled.
Example
use std::fs::OpenOptions;fnmain(){let file = OpenOptions::new().create(true).write(true)// useless `write` call, `append` will make it writable anyway.append(true).open("dump.json").unwrap();}
Could be written as:
use std::fs::OpenOptions;fnmain(){let file = OpenOptions::new().create(true).append(true).open("dump.json").unwrap();}
The text was updated successfully, but these errors were encountered:
What it does
This lint would warn when a user uses
std::fs::OpenOptions
ortokio::fs::OpenOptions
and calls bothwrite
andappend
Lint Name
no_write_and_append
Category
correctness, suspicious, pedantic
Advantage
write
call that doesn't have any affectDrawbacks
Some people might do this deliberately to highlight that writes are enabled.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: