From b607a6daaacd4c4d406e9cc1d4902a68557befc4 Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Wed, 28 Jan 2026 22:28:35 -0500 Subject: [PATCH] Remove optional from EditorTab::new. --- src/tui/app.rs | 2 +- src/tui/editor_tab.rs | 25 ++++++------------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/tui/app.rs b/src/tui/app.rs index bbcc807..9dfd72a 100644 --- a/src/tui/app.rs +++ b/src/tui/app.rs @@ -43,7 +43,7 @@ impl<'a> App<'a> { pub fn new(root_path: PathBuf) -> Result { trace!(target:Self::ID, "Building {}", Self::ID); let app = Self { - editor_tab: EditorTab::new(None), + editor_tab: EditorTab::new(), explorer: Explorer::new(&root_path)?, logger: Logger::new(), menu_bar: MenuBar::new(), diff --git a/src/tui/editor_tab.rs b/src/tui/editor_tab.rs index ed81196..f89f44c 100644 --- a/src/tui/editor_tab.rs +++ b/src/tui/editor_tab.rs @@ -21,25 +21,12 @@ pub struct EditorTab { impl EditorTab { pub const ID: &str = "EditorTab"; - pub fn new(path: Option<&std::path::PathBuf>) -> Self { - trace!(target:Self::ID, "Building EditorTab with path {path:?}"); - match path { - None => Self { - editors: HashMap::new(), - tab_order: Vec::new(), - current_editor: 0, - }, - Some(path) => { - let tab_order = vec![path.to_string_lossy().to_string()]; - Self { - editors: HashMap::from([( - tab_order.first().unwrap().to_owned(), - Editor::new(path), - )]), - tab_order, - current_editor: 0, - } - } + pub fn new() -> Self { + trace!(target:Self::ID, "Building {}", Self::ID); + Self { + editors: HashMap::new(), + tab_order: Vec::new(), + current_editor: 0, } }