From 7f83e785a77fbdbcada9c6714703d4e5801af82a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 29 May 2026 00:16:56 +0900 Subject: refactor(io): unify IOInterface params to Rc> Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/shirabe/src/command/diagnose_command.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'crates/shirabe/src/command/diagnose_command.rs') diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs index 945d1e9..bcedf30 100644 --- a/crates/shirabe/src/command/diagnose_command.rs +++ b/crates/shirabe/src/command/diagnose_command.rs @@ -79,7 +79,7 @@ impl DiagnoseCommand { output: &dyn OutputInterface, ) -> anyhow::Result { let mut composer = self.try_composer(None, None); - let io_boxed: std::rc::Rc> = self.get_io().clone(); + let io: std::rc::Rc> = self.get_io().clone(); let config: std::rc::Rc>; if let Some(ref mut c) = composer { @@ -104,7 +104,7 @@ impl DiagnoseCommand { .map(std::rc::Rc::clone) .unwrap_or_else(|| { std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some( - io_boxed.clone(), + io.clone(), )))) }), ); @@ -112,14 +112,9 @@ impl DiagnoseCommand { config = std::rc::Rc::new(std::cell::RefCell::new(Factory::create_config(None, None)?)); self.process = Some(std::rc::Rc::new(std::cell::RefCell::new( - ProcessExecutor::new(Some(io_boxed.clone())), + ProcessExecutor::new(Some(io.clone())), ))); } - // TODO(phase-b): clone_box to release self borrow held by get_io. - let io_box = self.get_io().clone(); - let io_ref = io_box.borrow(); - let io: &dyn IOInterface = &*io_ref; - let mut config_inner: IndexMap> = IndexMap::new(); config_inner.insert("secure-http".to_string(), Box::new(PhpMixed::Bool(false))); let mut secure_http_wrap: IndexMap = IndexMap::new(); @@ -130,12 +125,12 @@ impl DiagnoseCommand { .merge(&secure_http_wrap, Config::SOURCE_COMMAND); let _ = config.borrow_mut().prohibit_url_by_config( "http://repo.packagist.org", - Some(&NullIO::new()), + Some(std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()))), &IndexMap::new(), ); self.http_downloader = Some(std::rc::Rc::new(std::cell::RefCell::new( - Factory::create_http_downloader(io_box.clone(), &config, indexmap::IndexMap::new())?, + Factory::create_http_downloader(io.clone(), &config, indexmap::IndexMap::new())?, ))); if strpos(file!(), "phar:") == Some(0) { -- cgit v1.3.1