diff --git a/src/cli.rs b/src/cli.rs index 58768e9..095580b 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -11,8 +11,8 @@ use anyhow::{anyhow, Context, Result}; use chrono::Local; use clap::{Parser, Subcommand}; use fbink_rs::config::Font; -use fbink_rs::{FbInk, FbInkConfig}; use fbink_rs::image::ImageFormat; +use fbink_rs::{FbInk, FbInkConfig}; use nix::sys::signal::{kill, Signal}; use nix::unistd::Pid; use serde::{Deserialize, Serialize}; diff --git a/src/init.rs b/src/init.rs index 77f4fed..28b214a 100644 --- a/src/init.rs +++ b/src/init.rs @@ -31,12 +31,18 @@ pub fn merge_files(old_files: PathBuf, new_files: PathBuf) -> Result<()> { let (old, new) = (old_files.display(), new_files.display()); debug!("Merging {new} with {old}"); let mut existing = HashSet::new(); - for line in BufReader::new(File::open(&old_files)?).lines().flatten() { + for line in BufReader::new(File::open(&old_files)?) + .lines() + .map_while(Result::ok) + { existing.insert(line); } let file = File::options().append(true).open(&old_files)?; let mut file = LineWriter::new(file); - for line in BufReader::new(File::open(&new_files)?).lines().flatten() { + for line in BufReader::new(File::open(&new_files)?) + .lines() + .map_while(Result::ok) + { if !existing.contains(&line) { file.write_all(&line.into_bytes())?; } diff --git a/src/logging/mod.rs b/src/logging/mod.rs index 36a3e0d..8f5f87e 100644 --- a/src/logging/mod.rs +++ b/src/logging/mod.rs @@ -33,7 +33,7 @@ async fn get_log() -> Result { let mut encoder = GzEncoder::new(Vec::new(), Compression::default()); let to_write = stdout .lines() - .flatten() + .map_while(Result::ok) .filter(|l| l.contains("wifiremote") || l.contains("FBInk")); for line in to_write { diff --git a/src/management.rs b/src/management.rs index 74a056b..6c4eff7 100644 --- a/src/management.rs +++ b/src/management.rs @@ -31,10 +31,7 @@ async fn exit_handler(State(state): State) -> impl IntoResponse { (StatusCode::OK, "Exit successful") } else { warn!("Remote exit attempted but disabled in AppConfig"); - ( - StatusCode::FORBIDDEN, - "Remote exit disabled in AppConfig", - ) + (StatusCode::FORBIDDEN, "Remote exit disabled in AppConfig") } }