Fix formatting: reformat imports and thread closure
Apply rustfmt to fix formatting issues: - Reformat nested use statement for std::sync imports - Reformat thread::spawn closure to use inline loop syntax 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,10 @@ use crate::color::{apply, ColorEngine};
|
|||||||
use crate::utils::{ansi, ascii::AsciiArt, terminal::TerminalManager};
|
use crate::utils::{ansi, ascii::AsciiArt, terminal::TerminalManager};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use crossterm::event::{self, Event, KeyCode, KeyModifiers};
|
use crossterm::event::{self, Event, KeyCode, KeyModifiers};
|
||||||
use std::sync::{Arc, atomic::{AtomicBool, Ordering}};
|
use std::sync::{
|
||||||
|
atomic::{AtomicBool, Ordering},
|
||||||
|
Arc,
|
||||||
|
};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
|
|
||||||
@@ -41,26 +44,24 @@ impl<'a> Renderer<'a> {
|
|||||||
let should_exit = Arc::new(AtomicBool::new(false));
|
let should_exit = Arc::new(AtomicBool::new(false));
|
||||||
let should_exit_clone = should_exit.clone();
|
let should_exit_clone = should_exit.clone();
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || loop {
|
||||||
loop {
|
if let Ok(true) = event::poll(Duration::from_millis(100)) {
|
||||||
if let Ok(true) = event::poll(Duration::from_millis(100)) {
|
if let Ok(Event::Key(key)) = event::read() {
|
||||||
if let Ok(Event::Key(key)) = event::read() {
|
match key.code {
|
||||||
match key.code {
|
KeyCode::Char('q') | KeyCode::Esc => {
|
||||||
KeyCode::Char('q') | KeyCode::Esc => {
|
should_exit_clone.store(true, Ordering::Relaxed);
|
||||||
should_exit_clone.store(true, Ordering::Relaxed);
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
KeyCode::Char('c') if key.modifiers.contains(KeyModifiers::CONTROL) => {
|
|
||||||
should_exit_clone.store(true, Ordering::Relaxed);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
|
KeyCode::Char('c') if key.modifiers.contains(KeyModifiers::CONTROL) => {
|
||||||
|
should_exit_clone.store(true, Ordering::Relaxed);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if should_exit_clone.load(Ordering::Relaxed) {
|
}
|
||||||
break;
|
if should_exit_clone.load(Ordering::Relaxed) {
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user