Skip to content

Commit

Permalink
Fix new clippy lints + cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sublipri committed Jul 18, 2024
1 parent 74e8a40 commit 5bd805f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
10 changes: 8 additions & 2 deletions src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())?;
}
Expand Down
2 changes: 1 addition & 1 deletion src/logging/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn get_log() -> Result<impl IntoResponse, AppError> {
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 {
Expand Down
5 changes: 1 addition & 4 deletions src/management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ async fn exit_handler(State(state): State<AppState>) -> 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")
}
}

Expand Down

0 comments on commit 5bd805f

Please sign in to comment.