diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-18 00:48:13 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-18 00:48:13 +0900 |
| commit | d1960a8b7488dffe161080714447120fa6f85db1 (patch) | |
| tree | e3b77fe5bd8d71e6d3aabbfe45762cbc5d6f50ef | |
| parent | aaf2b0175e1f5b78fcfaae5c6b413588f31bc9e6 (diff) | |
| download | php-shirabe-d1960a8b7488dffe161080714447120fa6f85db1.tar.gz php-shirabe-d1960a8b7488dffe161080714447120fa6f85db1.tar.zst php-shirabe-d1960a8b7488dffe161080714447120fa6f85db1.zip | |
refactor(curl-downloader): drop unnecessary Rc wrapping around handles
CurlDownloader::auth_helper was never cloned out to another owner, so
Rc<RefCell<AuthHelper>> only needed the RefCell for interior
mutability (all methods take &self). Likewise HttpDownloader::dispatch
cloned self.rfs into a local binding it only ever used synchronously
(copy/get_contents don't await), so the clone bought nothing.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
| -rw-r--r-- | crates/shirabe/src/util/http/curl_downloader.rs | 7 | ||||
| -rw-r--r-- | crates/shirabe/src/util/http_downloader.rs | 2 |
2 files changed, 3 insertions, 6 deletions
diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs index 454836e7..47260a85 100644 --- a/crates/shirabe/src/util/http/curl_downloader.rs +++ b/crates/shirabe/src/util/http/curl_downloader.rs @@ -45,7 +45,7 @@ pub struct CurlDownloader { client: reqwest::Client, io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, config: std::rc::Rc<std::cell::RefCell<Config>>, - auth_helper: std::rc::Rc<std::cell::RefCell<AuthHelper>>, + auth_helper: std::cell::RefCell<AuthHelper>, max_redirects: i64, max_retries: i64, } @@ -88,10 +88,7 @@ impl CurlDownloader { // cannot proceed, mirroring PHP aborting when curl is missing. .expect("failed to build reqwest client for CurlDownloader"); - let auth_helper = std::rc::Rc::new(std::cell::RefCell::new(AuthHelper::new( - io.clone(), - config.clone(), - ))); + let auth_helper = std::cell::RefCell::new(AuthHelper::new(io.clone(), config.clone())); Self { client, diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs index c9e1e4a6..98678ad2 100644 --- a/crates/shirabe/src/util/http_downloader.rs +++ b/crates/shirabe/src/util/http_downloader.rs @@ -330,7 +330,7 @@ impl HttpDownloader { }; } - let rfs = self.rfs.as_ref().unwrap().clone(); + let rfs = self.rfs.as_ref().unwrap(); if let Some(copy_to) = copy_to { let (_, headers) = rfs.borrow_mut() |
