diff --git a/yazi-parser/src/app/plugin.rs b/yazi-parser/src/app/plugin.rs index 94a2a959..30184201 100644 --- a/yazi-parser/src/app/plugin.rs +++ b/yazi-parser/src/app/plugin.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, fmt::Debug, str::FromStr}; +use std::{borrow::Cow, fmt::{self, Debug}, str::FromStr}; use anyhow::bail; use dyn_clone::DynClone; @@ -7,7 +7,7 @@ use mlua::{Lua, Table}; use serde::Deserialize; use yazi_shared::{SStr, data::{Data, DataKey}, event::{Cmd, CmdCow}}; -#[derive(Clone, Default)] +#[derive(Clone, Debug, Default)] pub struct PluginOpt { pub id: SStr, pub args: HashMap, @@ -39,17 +39,6 @@ impl TryFrom for PluginOpt { } } -impl Debug for PluginOpt { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("PluginOpt") - .field("id", &self.id) - .field("args", &self.args) - .field("mode", &self.mode) - .field("callback", &self.callback.is_some()) - .finish() - } -} - impl PluginOpt { pub fn new_callback(id: impl Into, f: impl PluginCallback) -> Self { Self { @@ -112,3 +101,9 @@ impl PluginCallback for T where impl Clone for Box { fn clone(&self) -> Self { dyn_clone::clone_box(&**self) } } + +impl fmt::Debug for dyn PluginCallback { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("PluginCallback").finish_non_exhaustive() + } +}