aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader/file_downloader.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-25 16:16:33 +0900
committernsfisis <nsfisis@gmail.com>2026-07-25 16:17:10 +0900
commit432472808051cb4f1bb9517b858dbc810aaa5a63 (patch)
tree4c58b97942853ea2c3f58368203fa93187746cf8 /crates/shirabe/src/downloader/file_downloader.rs
parentd4608662f28b9a5135986b1702afe3199957eabe (diff)
downloadphp-shirabe-432472808051cb4f1bb9517b858dbc810aaa5a63.tar.gz
php-shirabe-432472808051cb4f1bb9517b858dbc810aaa5a63.tar.zst
php-shirabe-432472808051cb4f1bb9517b858dbc810aaa5a63.zip
refactor: replace redundant clones with moves
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/downloader/file_downloader.rs')
-rw-r--r--crates/shirabe/src/downloader/file_downloader.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/shirabe/src/downloader/file_downloader.rs b/crates/shirabe/src/downloader/file_downloader.rs
index aaa3995a..bb5c9705 100644
--- a/crates/shirabe/src/downloader/file_downloader.rs
+++ b/crates/shirabe/src/downloader/file_downloader.rs
@@ -224,7 +224,7 @@ impl DownloaderInterface for FileDownloader {
// TODO(plugin): dispatch PreFileDownloadEvent and apply its custom cache key / processed url.
urls[0] = url.clone();
- let checksum = package.get_dist_sha1_checksum().map(|s| s.to_string());
+ let checksum = package.get_dist_sha1_checksum();
let cache_key = url.cache_key.clone();
// use from cache if it is present and has a valid checksum or we have no checksum to check against
@@ -263,7 +263,7 @@ impl DownloaderInterface for FileDownloader {
self.last_cache_writes
.lock()
.unwrap()
- .insert(package.get_name().to_string(), cache_key.clone());
+ .insert(package.get_name(), cache_key.clone());
}
} else {
if output {
@@ -297,15 +297,15 @@ impl DownloaderInterface for FileDownloader {
DOWNLOAD_METADATA
.lock()
.unwrap()
- .insert(package.get_name().to_string(), file_size);
+ .insert(package.get_name(), file_size);
if Platform::get_env("GITHUB_ACTIONS").is_some()
&& Platform::get_env("COMPOSER_TESTS_ARE_RUNNING").is_none()
{
- RESPONSE_HEADERS.lock().unwrap().insert(
- package.get_name().to_string(),
- response.get_headers().clone(),
- );
+ RESPONSE_HEADERS
+ .lock()
+ .unwrap()
+ .insert(package.get_name(), response.get_headers().clone());
}
if let Some(cache) = self.cache.as_ref()
@@ -314,7 +314,7 @@ impl DownloaderInterface for FileDownloader {
self.last_cache_writes
.lock()
.unwrap()
- .insert(package.get_name().to_string(), cache_key.clone());
+ .insert(package.get_name(), cache_key.clone());
cache.borrow_mut().copy_from(&cache_key, &file_name);
}
@@ -479,7 +479,7 @@ impl DownloaderInterface for FileDownloader {
path.to_string(),
format!("{}/{}", vendor_dir, first_segment),
format!("{}/composer/", vendor_dir),
- vendor_dir.clone(),
+ vendor_dir,
];
if let Some(paths) = self