From 9df59059f0c1b3c123b1ae5be49e12418302ccea Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Mon, 16 Oct 2023 14:20:15 +0200
Subject: Style with clippy

---
 src/trace.rs | 27 ++++++++++-----------------
 src/ui.rs    |  4 ++--
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/src/trace.rs b/src/trace.rs
index e9ca481..bd38fa4 100644
--- a/src/trace.rs
+++ b/src/trace.rs
@@ -59,25 +59,18 @@ pub fn trace(pid: Pid, args: &Args) -> anyhow::Result<Vec<RegistersData>> {
     // because it could be equals except for the `rax` register.
     let mut have_to_print = true;
 
-    loop {
-        match trace_next(pid)? {
-            Some(reg) => {
-                have_to_print ^= true;
-                if have_to_print {
-                    if let Some(ref mut f) = f {
-                        writeln!(f, "{}", reg.output())?;
-                    }
-
-                    if args.no_tui {
-                        writeln!(io::stdout(), "{}", reg.output())?;
-                    }
-
-                    lines.push(reg);
-                }
+    while let Some(reg) = trace_next(pid)? {
+        have_to_print ^= true;
+        if have_to_print {
+            if let Some(ref mut f) = f {
+                writeln!(f, "{}", reg.output())?;
             }
-            None => {
-                break;
+
+            if args.no_tui {
+                writeln!(io::stdout(), "{}", reg.output())?;
             }
+
+            lines.push(reg);
         }
     }
     Ok(lines)
diff --git a/src/ui.rs b/src/ui.rs
index e6c8e1b..cf8078f 100644
--- a/src/ui.rs
+++ b/src/ui.rs
@@ -63,11 +63,11 @@ impl UI {
         let mut terminal = Terminal::new(CrosstermBackend::new(stdout()))?;
 
         let mut have_to_print = true;
-        let mut have_to_trace = !args.command.is_some();
+        let mut have_to_trace = args.command.is_none();
         let mut should_quit = false;
 
         if args.command.is_some() {
-            let registers = trace(pid, &args)?;
+            let registers = trace(pid, args)?;
             for register in registers {
                 self.add_line(register);
             }
-- 
cgit v1.2.3-18-g5258