From c5b04a897028261ca7bb0ebafeb1ab62a8c15135 Mon Sep 17 00:00:00 2001 From: arabian Date: Wed, 10 Jun 2026 15:12:19 +0300 Subject: [PATCH] fixed cargo clippy warnings --- src/dnf.rs | 6 +++--- src/gui.rs | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/dnf.rs b/src/dnf.rs index 7b5b56d..586f4c2 100644 --- a/src/dnf.rs +++ b/src/dnf.rs @@ -43,7 +43,7 @@ pub fn get_package_state(pkg: &rpm::Package) -> PackageState { let child_stdout = child.stdout.take().expect("Couldn't take stdout"); - for line in BufReader::new(child_stdout).lines().flatten() { + for line in BufReader::new(child_stdout).lines().map_while(Result::ok) { let parts: Vec<&str> = line.split_whitespace().collect(); if parts.len() != 3 { @@ -115,14 +115,14 @@ pub fn dnf_start_action( let stdout_thread = thread::spawn(move || { let stdout_lines = BufReader::new(child_stdout).lines(); - for line in stdout_lines.flatten() { + for line in stdout_lines.map_while(Result::ok) { stdout_tx.send(line).ok(); } }); let stderr_thread = thread::spawn(move || { let stderr_lines = BufReader::new(child_stderr).lines(); - for line in stderr_lines.flatten() { + for line in stderr_lines.map_while(Result::ok) { stderr_tx.send(line).ok(); } }); diff --git a/src/gui.rs b/src/gui.rs index 44b7412..82a2d19 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -57,12 +57,11 @@ impl Application { fn get_package_state(&mut self) -> JoinHandle<()> { let pkg_state_shared = self.pkg_state_shared.clone(); let pkg = self.pkg.clone(); - let thread = thread::spawn(move || { + thread::spawn(move || { let pkg_state = get_package_state(&pkg); let mut guard = pkg_state_shared.lock().unwrap(); *guard = Some(pkg_state); - }); - thread + }) } fn start_process(&mut self) {