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/util/config_validator.rs | 5 ++--- crates/shirabe/src/util/git.rs | 2 +- crates/shirabe/src/util/hg.rs | 2 +- crates/shirabe/src/util/http/curl_downloader.rs | 4 ++-- crates/shirabe/src/util/http_downloader.rs | 3 ++- crates/shirabe/src/util/remote_filesystem.rs | 4 ++-- crates/shirabe/src/util/svn.rs | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) (limited to 'crates/shirabe/src/util') diff --git a/crates/shirabe/src/util/config_validator.rs b/crates/shirabe/src/util/config_validator.rs index 47b4968..5621841 100644 --- a/crates/shirabe/src/util/config_validator.rs +++ b/crates/shirabe/src/util/config_validator.rs @@ -39,9 +39,8 @@ impl ConfigValidator { let mut lax_valid = false; let mut manifest: Option> = None; - // TODO(phase-b): io type mismatch (&dyn IOInterface vs std::rc::Rc>) - let mut json = - JsonFile::new(file.to_string(), None, None).expect("config file path is always local"); + let mut json = JsonFile::new(file.to_string(), None, Some(self.io.clone())) + .expect("config file path is always local"); let schema_result: anyhow::Result<()> = (|| -> anyhow::Result<()> { manifest = Some(match json.read()? { PhpMixed::Array(m) => m.into_iter().map(|(k, v)| (k, *v)).collect(), diff --git a/crates/shirabe/src/util/git.rs b/crates/shirabe/src/util/git.rs index 1f6fd0a..b2438c7 100644 --- a/crates/shirabe/src/util/git.rs +++ b/crates/shirabe/src/util/git.rs @@ -150,7 +150,7 @@ impl Git { // Ensure we are allowed to use this URL by config self.config.borrow_mut().prohibit_url_by_config( url, - Some(&*self.io.borrow()), + Some(self.io.clone()), &IndexMap::new(), )?; diff --git a/crates/shirabe/src/util/hg.rs b/crates/shirabe/src/util/hg.rs index 47e80e2..f5ee256 100644 --- a/crates/shirabe/src/util/hg.rs +++ b/crates/shirabe/src/util/hg.rs @@ -36,7 +36,7 @@ impl Hg { ) -> Result<()> { self.config.borrow_mut().prohibit_url_by_config( &url, - Some(&*self.io.borrow()), + Some(self.io.clone()), &indexmap::IndexMap::new(), )?; diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs index 71c0b5a..b86564f 100644 --- a/crates/shirabe/src/util/http/curl_downloader.rs +++ b/crates/shirabe/src/util/http/curl_downloader.rs @@ -341,7 +341,7 @@ impl CurlDownloader { { self.config.borrow_mut().prohibit_url_by_config( url, - Some(&*self.io.borrow()), + Some(self.io.clone()), &options, )?; } @@ -1187,7 +1187,7 @@ impl CurlDownloader { == Some("application/json") { HttpDownloader::output_warnings( - &*self.io.borrow(), + self.io.clone(), job.get("origin").and_then(|v| v.as_string()).unwrap_or(""), &match json_decode(response_ref.inner.get_body().unwrap_or(""), true)? { PhpMixed::Array(a) => a.into_iter().map(|(k, v)| (k, *v)).collect(), diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs index 610bd3a..166f1f8 100644 --- a/crates/shirabe/src/util/http_downloader.rs +++ b/crates/shirabe/src/util/http_downloader.rs @@ -18,6 +18,7 @@ use crate::composer::ComposerHandle; use crate::config::Config; use crate::downloader::TransportException; use crate::io::IOInterface; +use crate::io::IOInterfaceImmutable; use crate::package::version::VersionParser; use crate::util::GetResult; use crate::util::Platform; @@ -689,7 +690,7 @@ impl HttpDownloader { /// /// @param array{warning?: string, info?: string, warning-versions?: string, info-versions?: string, warnings?: array, infos?: array} $data pub fn output_warnings( - io: &dyn IOInterface, + io: std::rc::Rc>, url: &str, data: &IndexMap, ) -> Result<()> { diff --git a/crates/shirabe/src/util/remote_filesystem.rs b/crates/shirabe/src/util/remote_filesystem.rs index 9aa40bd..22f5ea2 100644 --- a/crates/shirabe/src/util/remote_filesystem.rs +++ b/crates/shirabe/src/util/remote_filesystem.rs @@ -292,7 +292,7 @@ impl RemoteFilesystem { { let _ = self.config.borrow_mut().prohibit_url_by_config( &file_url, - Some(&*self.io.borrow()), + Some(self.io.clone()), &indexmap::IndexMap::new(), ); } @@ -338,7 +338,7 @@ impl RemoteFilesystem { _ => IndexMap::new(), }; let _ = HttpDownloader::output_warnings( - &*self.io.borrow(), + self.io.clone(), origin_url, &parsed_map, ); diff --git a/crates/shirabe/src/util/svn.rs b/crates/shirabe/src/util/svn.rs index 737e75d..7634b62 100644 --- a/crates/shirabe/src/util/svn.rs +++ b/crates/shirabe/src/util/svn.rs @@ -98,7 +98,7 @@ impl Svn { // Ensure we are allowed to use this URL by config self.config.borrow_mut().prohibit_url_by_config( url, - Some(&*self.io.borrow()), + Some(self.io.clone()), &indexmap::IndexMap::new(), )?; -- cgit v1.3.1