diff --git a/yazi-config/src/boot/args.rs b/yazi-config/src/boot/args.rs index 4ba5bf45..ccfb65c3 100644 --- a/yazi-config/src/boot/args.rs +++ b/yazi-config/src/boot/args.rs @@ -11,10 +11,10 @@ pub struct Args { /// Write the cwd on exit to this file #[arg(long)] - pub cwd_file: Option, + pub cwd_file: Option, /// Write the selected files on open emitted by the chooser mode #[arg(long)] - pub chooser_file: Option, + pub chooser_file: Option, /// Write the selected files on open to stdout #[arg(long, action)] pub chooser_stdout: bool, diff --git a/yazi-core/src/manager/commands/open.rs b/yazi-core/src/manager/commands/open.rs index 9268338e..c5ec3b11 100644 --- a/yazi-core/src/manager/commands/open.rs +++ b/yazi-core/src/manager/commands/open.rs @@ -3,18 +3,12 @@ use std::ffi::OsString; use tracing::error; use yazi_config::{popup::SelectCfg, ARGS, OPEN}; use yazi_plugin::isolate; -use yazi_shared::event::QuitAction; -use yazi_shared::{ - emit, - event::Exec, - fs::{File, Url}, - Layer, MIME_DIR, -}; +use yazi_shared::{emit, event::{Exec, QuitAction}, fs::{File, Url}, Layer, MIME_DIR}; use crate::{manager::Manager, select::Select, tasks::Tasks}; pub struct Opt { - targets: Option)>>, + targets: Option)>>, interactive: bool, } diff --git a/yazi-core/src/manager/commands/quit.rs b/yazi-core/src/manager/commands/quit.rs index 00c1f839..bd112c22 100644 --- a/yazi-core/src/manager/commands/quit.rs +++ b/yazi-core/src/manager/commands/quit.rs @@ -1,8 +1,5 @@ use yazi_config::popup::InputCfg; -use yazi_shared::{ - emit, - event::{Exec, QuitAction}, -}; +use yazi_shared::{emit, event::{Exec, QuitAction}}; use crate::{input::Input, manager::Manager, tasks::Tasks}; @@ -11,14 +8,10 @@ pub struct Opt { no_cwd_file: bool, } impl From<()> for Opt { - fn from(_: ()) -> Self { - Self::default() - } + fn from(_: ()) -> Self { Self::default() } } impl From<&Exec> for Opt { - fn from(e: &Exec) -> Self { - Self { no_cwd_file: e.named.contains_key("no-cwd-file") } - } + fn from(e: &Exec) -> Self { Self { no_cwd_file: e.named.contains_key("no-cwd-file") } } } impl Manager { diff --git a/yazi-fm/src/app/app.rs b/yazi-fm/src/app/app.rs index 9ea36edc..d2501ff9 100644 --- a/yazi-fm/src/app/app.rs +++ b/yazi-fm/src/app/app.rs @@ -4,18 +4,13 @@ use anyhow::{Ok, Result}; use crossterm::event::KeyEvent; use yazi_config::keymap::Key; use yazi_core::input::InputMode; -use yazi_shared::{ - emit, - event::{Event, Exec, NEED_RENDER}, - term::Term, - Layer, -}; +use yazi_shared::{emit, event::{Event, Exec, NEED_RENDER}, term::Term, Layer}; use crate::{lives::Lives, Ctx, Executor, Logs, Panic, Signals}; pub(crate) struct App { - pub(crate) cx: Ctx, - pub(crate) term: Option, + pub(crate) cx: Ctx, + pub(crate) term: Option, pub(crate) signals: Signals, } @@ -59,9 +54,7 @@ impl App { } #[inline] - fn dispatch_key(&mut self, key: KeyEvent) { - Executor::new(self).handle(Key::from(key)); - } + fn dispatch_key(&mut self, key: KeyEvent) { Executor::new(self).handle(Key::from(key)); } fn dispatch_paste(&mut self, str: String) { if self.cx.input.visible { diff --git a/yazi-fm/src/signals.rs b/yazi-fm/src/signals.rs index ef4de9a3..54654568 100644 --- a/yazi-fm/src/signals.rs +++ b/yazi-fm/src/signals.rs @@ -1,18 +1,11 @@ use anyhow::Result; use crossterm::event::{Event as CrosstermEvent, EventStream, KeyEvent, KeyEventKind}; use futures::StreamExt; -use tokio::{ - select, - sync::{ - mpsc::{self, UnboundedReceiver, UnboundedSender}, - oneshot, - }, - task::JoinHandle, -}; +use tokio::{select, sync::{mpsc::{self, UnboundedReceiver, UnboundedSender}, oneshot}, task::JoinHandle}; use yazi_shared::event::Event; pub(super) struct Signals { - tx: UnboundedSender, + tx: UnboundedSender, pub(super) rx: UnboundedReceiver, term_stop_tx: Option>, @@ -49,9 +42,7 @@ impl Signals { } #[cfg(windows)] - fn spawn_system_task(&self) -> Result<()> { - Ok(()) - } + fn spawn_system_task(&self) -> Result<()> { Ok(()) } #[cfg(unix)] fn spawn_system_task(&self) -> Result> { diff --git a/yazi-shared/src/event/event.rs b/yazi-shared/src/event/event.rs index 572bf9f4..01ffa430 100644 --- a/yazi-shared/src/event/event.rs +++ b/yazi-shared/src/event/event.rs @@ -28,14 +28,10 @@ pub enum QuitAction { impl Event { #[inline] - pub fn init(tx: UnboundedSender) { - TX.init(tx); - } + pub fn init(tx: UnboundedSender) { TX.init(tx); } #[inline] - pub fn emit(self) { - TX.send(self).ok(); - } + pub fn emit(self) { TX.send(self).ok(); } pub async fn wait(self, rx: oneshot::Receiver) -> T { TX.send(self).ok(); diff --git a/yazi-shared/src/term/term.rs b/yazi-shared/src/term/term.rs index ddde459a..40694e6f 100644 --- a/yazi-shared/src/term/term.rs +++ b/yazi-shared/src/term/term.rs @@ -1,21 +1,7 @@ -use std::{ - io::{stdout, Stdout, Write}, - mem, - ops::{Deref, DerefMut}, -}; +use std::{io::{stdout, Stdout, Write}, mem, ops::{Deref, DerefMut}}; use anyhow::Result; -use crossterm::{ - event::{ - DisableBracketedPaste, DisableFocusChange, EnableBracketedPaste, EnableFocusChange, - KeyboardEnhancementFlags, PopKeyboardEnhancementFlags, PushKeyboardEnhancementFlags, - }, - execute, queue, - terminal::{ - disable_raw_mode, enable_raw_mode, supports_keyboard_enhancement, Clear, ClearType, - EnterAlternateScreen, LeaveAlternateScreen, WindowSize, - }, -}; +use crossterm::{event::{DisableBracketedPaste, DisableFocusChange, EnableBracketedPaste, EnableFocusChange, KeyboardEnhancementFlags, PopKeyboardEnhancementFlags, PushKeyboardEnhancementFlags}, execute, queue, terminal::{disable_raw_mode, enable_raw_mode, supports_keyboard_enhancement, Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen, WindowSize}}; use ratatui::{backend::CrosstermBackend, Terminal}; pub struct Term { @@ -121,21 +107,15 @@ impl Term { } impl Drop for Term { - fn drop(&mut self) { - self.stop().ok(); - } + fn drop(&mut self) { self.stop().ok(); } } impl Deref for Term { type Target = Terminal>; - fn deref(&self) -> &Self::Target { - &self.inner - } + fn deref(&self) -> &Self::Target { &self.inner } } impl DerefMut for Term { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.inner - } + fn deref_mut(&mut self) -> &mut Self::Target { &mut self.inner } }