Fix clippy in beta toolchain (#4299)

* clippy::lines_filter_map_ok

* clippy::ineffective-open-options
This commit is contained in:
Jon Häggblad
2024-01-10 15:29:05 +01:00
committed by GitHub
parent be46da9906
commit 549b33cd91
2 changed files with 2 additions and 6 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ impl FailedIpAddresses {
if Path::new(&file_path).exists() {
if let Ok(file) = File::open(&file_path) {
let lines = io::BufReader::new(file).lines();
for ip in lines.flatten() {
for ip in lines.map_while(Result::ok) {
failed_ips.insert(ip);
}
}
@@ -96,11 +96,7 @@ impl HostsStore {
/// Appends a line of `text` to the storefile at `path`
pub(super) fn append(path: &Path, text: &str) {
use std::io::Write;
let mut file = OpenOptions::new()
.write(true)
.append(true)
.open(path)
.unwrap();
let mut file = OpenOptions::new().append(true).open(path).unwrap();
if let Err(e) = writeln!(file, "{text}") {
log::error!("Couldn't write to file: {e}");