diff --git a/yazi-core/src/manager/commands/close.rs b/yazi-core/src/manager/commands/close.rs index 3cd467ba..568b66ea 100644 --- a/yazi-core/src/manager/commands/close.rs +++ b/yazi-core/src/manager/commands/close.rs @@ -1,19 +1,17 @@ use yazi_shared::event::CmdCow; -use crate::{manager::Manager, tasks::Tasks, manager::commands::quit}; +use crate::{manager::{Manager, commands::quit}, tasks::Tasks}; #[derive(Default)] struct Opt { no_cwd_file: bool, } - -impl From<()> for Opt { - fn from(_: ()) -> Self { Self::default() } -} - impl From for Opt { fn from(c: CmdCow) -> Self { Self { no_cwd_file: c.bool("no-cwd-file") } } } +impl From for quit::Opt { + fn from(value: Opt) -> Self { Self { no_cwd_file: value.no_cwd_file } } +} impl Manager { #[yazi_codegen::command] @@ -21,6 +19,6 @@ impl Manager { if self.tabs.len() > 1 { return self.tabs.close(self.tabs.cursor); } - self.quit(quit::Opt{ no_cwd_file: opt.no_cwd_file }, tasks); + self.quit(opt, tasks); } } diff --git a/yazi-core/src/manager/commands/quit.rs b/yazi-core/src/manager/commands/quit.rs index abed3141..fe1e517b 100644 --- a/yazi-core/src/manager/commands/quit.rs +++ b/yazi-core/src/manager/commands/quit.rs @@ -9,12 +9,9 @@ use yazi_shared::event::{CmdCow, EventQuit}; use crate::{manager::Manager, tasks::Tasks}; #[derive(Default)] -pub struct Opt { +pub(super) struct Opt { pub no_cwd_file: bool, } -impl From<()> for Opt { - fn from(_: ()) -> Self { Self::default() } -} impl From for Opt { fn from(c: CmdCow) -> Self { Self { no_cwd_file: c.bool("no-cwd-file") } } }