perf: reduce size of DialogPage enum by 1000 bytes

This commit is contained in:
Michael Aaron Murphy 2026-05-01 15:15:59 +02:00 committed by Michael Murphy
parent 72b40aece3
commit cd48e4fa30
3 changed files with 7 additions and 7 deletions

View file

@ -287,7 +287,7 @@ impl MenuAction for Action {
} }
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct PreviewItem(pub tab::Item); pub struct PreviewItem(pub Box<tab::Item>);
impl PartialEq for PreviewItem { impl PartialEq for PreviewItem {
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
@ -573,8 +573,8 @@ pub enum DialogPage {
dir: bool, dir: bool,
}, },
Replace { Replace {
from: tab::Item, from: Box<tab::Item>,
to: tab::Item, to: Box<tab::Item>,
multiple: bool, multiple: bool,
apply_to_all: bool, apply_to_all: bool,
conflict_count: usize, conflict_count: usize,
@ -5205,7 +5205,7 @@ impl Application for App {
Ok(item) => { Ok(item) => {
self.context_page = ContextPage::Preview( self.context_page = ContextPage::Preview(
None, None,
PreviewKind::Custom(PreviewItem(item)), PreviewKind::Custom(PreviewItem(Box::new(item))),
); );
self.set_show_context(true); self.set_show_context(true);
} }

View file

@ -34,7 +34,7 @@ async fn handle_replace(
conflict_count: usize, conflict_count: usize,
) -> ReplaceResult { ) -> ReplaceResult {
let item_from = match tab::item_from_path(file_from, IconSizes::default()) { let item_from = match tab::item_from_path(file_from, IconSizes::default()) {
Ok(ok) => ok, Ok(ok) => Box::new(ok),
Err(err) => { Err(err) => {
log::warn!("{err}"); log::warn!("{err}");
return ReplaceResult::Cancel; return ReplaceResult::Cancel;
@ -42,7 +42,7 @@ async fn handle_replace(
}; };
let item_to = match tab::item_from_path(file_to, IconSizes::default()) { let item_to = match tab::item_from_path(file_to, IconSizes::default()) {
Ok(ok) => ok, Ok(ok) => Box::new(ok),
Err(err) => { Err(err) => {
log::warn!("{err}"); log::warn!("{err}");
return ReplaceResult::Cancel; return ReplaceResult::Cancel;

View file

@ -3587,7 +3587,7 @@ impl Tab {
match item_from_path(&path, IconSizes::default()) { match item_from_path(&path, IconSizes::default()) {
Ok(item) => { Ok(item) => {
commands.push(Command::Preview(PreviewKind::Custom( commands.push(Command::Preview(PreviewKind::Custom(
PreviewItem(item), PreviewItem(Box::new(item)),
))); )));
} }
Err(err) => { Err(err) => {