From c7f53c5d7d581ebf76803650c63ec615b1558dc8 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 28 May 2026 03:31:41 +0900 Subject: refactor(composer): represent composer via trait-based handles Replace the PartialComposer/Composer structs and the single Rc> enum with PartialComposer and Composer traits (Composer: PartialComposer), InnerPartialComposer / InnerFullComposer data structs, and the handle types FullComposerHandle (impl Composer) and AnyComposerHandle (polymorphic enum, impl PartialComposer), plus their weak variants. Factory builds the full and partial graphs via separate Rc::new_cyclic branches that share a build_composer_base helper. Call sites now use trait methods that encapsulate borrowing instead of borrow_partial() / composer_full*(). Co-Authored-By: Claude Opus 4.7 --- crates/shirabe/src/console/application.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src/console') diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index f27ed79..c8f8e43 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -67,8 +67,7 @@ use crate::command::SuggestsCommand; use crate::command::UpdateCommand; use crate::command::ValidateCommand; use crate::composer; -use crate::composer::ComposerHandle; -use crate::composer::PartialComposerHandle; +use crate::composer::{AnyComposerHandle, Composer, PartialComposer}; use crate::console::GithubActionError; use crate::downloader::TransportException; use crate::event_dispatcher::ScriptExecutionException; @@ -89,7 +88,7 @@ use crate::util::Silencer; #[derive(Debug)] pub struct Application { inner: BaseApplication, - pub(crate) composer: Option, + pub(crate) composer: Option, pub(crate) io: std::rc::Rc>, has_plugin_commands: bool, disable_plugins_by_default: bool, @@ -854,7 +853,6 @@ impl Application { let composer = self.get_composer(false, Some(true), None)?; if composer.is_some() && function_exists("disk_free_space") { let composer = composer.unwrap(); - let composer = composer.borrow_partial(); let config = composer.get_config(); let min_space_free: f64 = 100.0 * 1024.0 * 1024.0; @@ -986,7 +984,7 @@ impl Application { required: bool, disable_plugins: Option, disable_scripts: Option, - ) -> anyhow::Result> { + ) -> anyhow::Result> { let disable_plugins = disable_plugins.unwrap_or(self.disable_plugins_by_default); let disable_scripts = disable_scripts.unwrap_or(self.disable_scripts_by_default); -- cgit v1.3.1