aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-20 18:34:54 +0900
committernsfisis <nsfisis@gmail.com>2026-06-20 18:34:54 +0900
commit81b9fc9d92bb74aa8428ae4db39bd84e8c16095c (patch)
tree3efb6476d797e2a95545c4c3abba468c3e3c8d52 /crates/shirabe/src/repository/vcs
parentc09cd630afb4bb0ca10e926f93bf706ca828ae85 (diff)
downloadphp-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.tar.gz
php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.tar.zst
php-shirabe-81b9fc9d92bb74aa8428ae4db39bd84e8c16095c.zip
refactor(php-shim): drop Box wrapping from PhpMixed List/Array
The List and Array variants of PhpMixed boxed their elements unnecessarily. Store PhpMixed values directly and update all callers accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/vcs')
-rw-r--r--crates/shirabe/src/repository/vcs/forgejo_driver.rs20
-rw-r--r--crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs56
-rw-r--r--crates/shirabe/src/repository/vcs/github_driver.rs30
-rw-r--r--crates/shirabe/src/repository/vcs/gitlab_driver.rs53
-rw-r--r--crates/shirabe/src/repository/vcs/svn_driver.rs5
-rw-r--r--crates/shirabe/src/repository/vcs/vcs_driver.rs19
6 files changed, 69 insertions, 114 deletions
diff --git a/crates/shirabe/src/repository/vcs/forgejo_driver.rs b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
index 3706e02..18f1cf1 100644
--- a/crates/shirabe/src/repository/vcs/forgejo_driver.rs
+++ b/crates/shirabe/src/repository/vcs/forgejo_driver.rs
@@ -246,7 +246,7 @@ impl ForgejoDriver {
let branch_data = response.decode_json()?;
if let PhpMixed::List(ref list) = branch_data {
for branch in list {
- if let PhpMixed::Array(ref arr) = **branch {
+ if let PhpMixed::Array(ref arr) = *branch {
let name = arr
.get("name")
.and_then(|v| v.as_string())
@@ -289,7 +289,7 @@ impl ForgejoDriver {
let tags_data = response.decode_json()?;
if let PhpMixed::List(ref list) = tags_data {
for tag in list {
- if let PhpMixed::Array(ref arr) = **tag {
+ if let PhpMixed::Array(ref arr) = *tag {
let name = arr
.get("name")
.and_then(|v| v.as_string())
@@ -341,9 +341,7 @@ impl ForgejoDriver {
let composer = if self.inner.should_cache(identifier) {
if let Some(res) = self.inner.cache.as_mut().and_then(|c| c.read(identifier)) {
let parsed = JsonFile::parse_json(Some(res.as_str()), None)?;
- parsed
- .as_array()
- .map(|m| m.iter().map(|(k, v)| (k.clone(), (**v).clone())).collect())
+ parsed.as_array().map(|m| m.clone())
} else {
let file_content = self.get_file_content("composer.json", identifier)?;
let c = VcsDriverBase::finish_base_composer_information(
@@ -358,7 +356,7 @@ impl ForgejoDriver {
&PhpMixed::Array(
composer_map
.iter()
- .map(|(k, v)| (k.clone(), Box::new(v.clone())))
+ .map(|(k, v)| (k.clone(), v.clone()))
.collect(),
),
JsonEncodeOptions {
@@ -423,8 +421,7 @@ impl ForgejoDriver {
};
if let Some(PhpMixed::Array(support)) = composer_map.get_mut("support") {
- support
- .insert("source".to_string(), Box::new(PhpMixed::String(source_url)));
+ support.insert("source".to_string(), PhpMixed::String(source_url));
}
}
@@ -442,8 +439,7 @@ impl ForgejoDriver {
.unwrap_or_default()
);
if let Some(PhpMixed::Array(support)) = composer_map.get_mut("support") {
- support
- .insert("issues".to_string(), Box::new(PhpMixed::String(issues_url)));
+ support.insert("issues".to_string(), PhpMixed::String(issues_url));
}
}
@@ -574,9 +570,7 @@ impl ForgejoDriver {
return Ok(());
}
if let PhpMixed::Array(ref arr) = data {
- let map: IndexMap<String, PhpMixed> =
- arr.iter().map(|(k, v)| (k.clone(), *v.clone())).collect();
- self.repository_data = Some(ForgejoRepositoryData::from_remote_data(&map)?);
+ self.repository_data = Some(ForgejoRepositoryData::from_remote_data(arr)?);
}
}
}
diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
index 44c0d08..fb450d8 100644
--- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs
@@ -198,7 +198,7 @@ impl GitBitbucketDriver {
PhpMixed::Array(m) => m.get("branches"),
_ => None,
})
- .and_then(|v| match v.as_ref() {
+ .and_then(|v| match v {
PhpMixed::Array(m) => m.get("href").and_then(|v| v.as_string()).map(String::from),
_ => None,
})
@@ -209,7 +209,7 @@ impl GitBitbucketDriver {
PhpMixed::Array(m) => m.get("tags"),
_ => None,
})
- .and_then(|v| match v.as_ref() {
+ .and_then(|v| match v {
PhpMixed::Array(m) => m.get("href").and_then(|v| v.as_string()).map(String::from),
_ => None,
})
@@ -220,7 +220,7 @@ impl GitBitbucketDriver {
PhpMixed::Array(m) => m.get("html"),
_ => None,
})
- .and_then(|v| match v.as_ref() {
+ .and_then(|v| match v {
PhpMixed::Array(m) => m.get("href").and_then(|v| v.as_string()).map(String::from),
_ => None,
})
@@ -236,7 +236,7 @@ impl GitBitbucketDriver {
.map(String::from);
self.repo_data = match repo_data {
- PhpMixed::Array(m) => m.into_iter().map(|(k, v)| (k, *v)).collect(),
+ PhpMixed::Array(m) => m,
_ => IndexMap::new(),
};
@@ -259,7 +259,7 @@ impl GitBitbucketDriver {
if let Some(res) = res {
composer = JsonFile::parse_json(Some(&res), None)?
.as_array()
- .map(|m| m.iter().map(|(k, v)| (k.clone(), (**v).clone())).collect());
+ .map(|m| m.clone());
true
} else {
false
@@ -279,12 +279,7 @@ impl GitBitbucketDriver {
identifier,
&JsonFile::encode_with_options(
&PhpMixed::Array(
- composer
- .clone()
- .unwrap_or_default()
- .into_iter()
- .map(|(k, v)| (k, Box::new(v)))
- .collect(),
+ composer.clone().unwrap_or_default().into_iter().collect(),
),
JsonEncodeOptions {
pretty_print: false,
@@ -316,7 +311,7 @@ impl GitBitbucketDriver {
&PhpMixed::String(identifier.to_string()),
&PhpMixed::Array(
tags.iter()
- .map(|(k, v)| (k.clone(), Box::new(PhpMixed::String(v.clone()))))
+ .map(|(k, v)| (k.clone(), PhpMixed::String(v.clone())))
.collect(),
),
false,
@@ -327,9 +322,7 @@ impl GitBitbucketDriver {
&PhpMixed::Array(
branches_for_search
.iter()
- .map(|(k, v)| {
- (k.clone(), Box::new(PhpMixed::String(v.clone())))
- })
+ .map(|(k, v)| (k.clone(), PhpMixed::String(v.clone())))
.collect(),
),
false,
@@ -354,25 +347,25 @@ impl GitBitbucketDriver {
if let PhpMixed::Array(support_map) = support_entry {
support_map.insert(
"source".to_string(),
- Box::new(PhpMixed::String(format!(
+ PhpMixed::String(format!(
"https://{}/{}/{}/src",
PhpMixed::String(self.inner.origin_url.clone()),
PhpMixed::String(self.owner.clone()),
PhpMixed::String(self.repository.clone()),
- ))),
+ )),
);
}
} else if let PhpMixed::Array(support_map) = support_entry {
support_map.insert(
"source".to_string(),
- Box::new(PhpMixed::String(format!(
+ PhpMixed::String(format!(
"https://{}/{}/{}/src/{}/?at={}",
PhpMixed::String(self.inner.origin_url.clone()),
PhpMixed::String(self.owner.clone()),
PhpMixed::String(self.repository.clone()),
PhpMixed::String(hash.unwrap()),
PhpMixed::String(label.clone()),
- ))),
+ )),
);
}
}
@@ -390,12 +383,12 @@ impl GitBitbucketDriver {
if let PhpMixed::Array(support_map) = support_entry {
support_map.insert(
"issues".to_string(),
- Box::new(PhpMixed::String(format!(
+ PhpMixed::String(format!(
"https://{}/{}/{}/issues",
PhpMixed::String(self.inner.origin_url.clone()),
PhpMixed::String(self.owner.clone()),
PhpMixed::String(self.repository.clone()),
- ))),
+ )),
);
}
}
@@ -555,7 +548,7 @@ impl GitBitbucketDriver {
let values = tags_data.get("values").cloned();
if let Some(PhpMixed::List(list)) = values {
for data in list {
- if let PhpMixed::Array(m) = data.as_ref() {
+ if let PhpMixed::Array(m) = data {
let name = m
.get("name")
.and_then(|v| v.as_string())
@@ -563,7 +556,7 @@ impl GitBitbucketDriver {
.to_string();
let hash = m
.get("target")
- .and_then(|v| match v.as_ref() {
+ .and_then(|v| match v {
PhpMixed::Array(m) => m.get("hash"),
_ => None,
})
@@ -636,7 +629,7 @@ impl GitBitbucketDriver {
let values = branch_data.get("values").cloned();
if let Some(PhpMixed::List(list)) = values {
for data in list {
- if let PhpMixed::Array(m) = data.as_ref() {
+ if let PhpMixed::Array(m) = data {
let name = m
.get("name")
.and_then(|v| v.as_string())
@@ -644,7 +637,7 @@ impl GitBitbucketDriver {
.to_string();
let hash = m
.get("target")
- .and_then(|v| match v.as_ref() {
+ .and_then(|v| match v {
PhpMixed::Array(m) => m.get("hash"),
_ => None,
})
@@ -702,10 +695,7 @@ impl GitBitbucketDriver {
let code = te.get_code();
let in_set = in_array(
PhpMixed::Int(code),
- &PhpMixed::List(vec![
- Box::new(PhpMixed::Int(403)),
- Box::new(PhpMixed::Int(404)),
- ]),
+ &PhpMixed::List(vec![PhpMixed::Int(403), PhpMixed::Int(404)]),
true,
);
if in_set
@@ -783,13 +773,13 @@ impl GitBitbucketDriver {
}
/// @param array<array{name: string, href: string}> $cloneLinks
- fn parse_clone_urls(&mut self, clone_links: Option<Box<PhpMixed>>) {
- let list = match clone_links.as_deref() {
- Some(PhpMixed::List(l)) => l.clone(),
+ fn parse_clone_urls(&mut self, clone_links: Option<PhpMixed>) {
+ let list = match clone_links {
+ Some(PhpMixed::List(l)) => l,
_ => return,
};
for clone_link in list {
- if let PhpMixed::Array(m) = clone_link.as_ref()
+ if let PhpMixed::Array(m) = clone_link
&& m.get("name").and_then(|v| v.as_string()) == Some("https")
{
// Format: https://(user@)bitbucket.org/{user}/{repo}
diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs
index 8c8c81a..e9956a9 100644
--- a/crates/shirabe/src/repository/vcs/github_driver.rs
+++ b/crates/shirabe/src/repository/vcs/github_driver.rs
@@ -279,9 +279,7 @@ impl GitHubDriver {
.and_then(|c| c.read(identifier))
.unwrap_or_default();
let parsed = JsonFile::parse_json(Some(&res), None)?;
- parsed
- .as_array()
- .map(|m| m.iter().map(|(k, v)| (k.clone(), (**v).clone())).collect())
+ parsed.as_array().map(|m| m.clone())
} else {
let file_content = self.get_file_content("composer.json", identifier)?;
let composer = VcsDriverBase::finish_base_composer_information(
@@ -296,7 +294,7 @@ impl GitHubDriver {
let php_value: PhpMixed = PhpMixed::Array(
composer_map
.iter()
- .map(|(k, v)| (k.clone(), Box::new(v.clone())))
+ .map(|(k, v)| (k.clone(), v.clone()))
.collect(),
);
self.inner.cache.as_mut().map(|c| {
@@ -337,7 +335,7 @@ impl GitHubDriver {
&PhpMixed::Array(
tags_map
.into_iter()
- .map(|(k, v)| (k, Box::new(PhpMixed::String(v))))
+ .map(|(k, v)| (k, PhpMixed::String(v)))
.collect(),
),
false,
@@ -349,7 +347,7 @@ impl GitHubDriver {
&PhpMixed::Array(
branches_map
.into_iter()
- .map(|(k, v)| (k, Box::new(PhpMixed::String(v))))
+ .map(|(k, v)| (k, PhpMixed::String(v)))
.collect(),
),
false,
@@ -364,13 +362,13 @@ impl GitHubDriver {
}) {
support.insert(
"source".to_string(),
- Box::new(PhpMixed::String(format!(
+ PhpMixed::String(format!(
"https://{}/{}/{}/tree/{}",
PhpMixed::String(self.inner.origin_url.clone()),
PhpMixed::String(self.owner.clone()),
PhpMixed::String(self.repository.clone()),
PhpMixed::String(label_str),
- ))),
+ )),
);
}
}
@@ -388,12 +386,12 @@ impl GitHubDriver {
{
support.insert(
"issues".to_string(),
- Box::new(PhpMixed::String(format!(
+ PhpMixed::String(format!(
"https://{}/{}/{}/issues",
PhpMixed::String(self.inner.origin_url.clone()),
PhpMixed::String(self.owner.clone()),
PhpMixed::String(self.repository.clone()),
- ))),
+ )),
);
}
if !composer.contains_key("abandoned") && self.is_archived {
@@ -711,11 +709,7 @@ impl GitHubDriver {
let result_mixed = PhpMixed::List(
result
.into_iter()
- .map(|m| {
- Box::new(PhpMixed::Array(
- m.into_iter().map(|(k, v)| (k, Box::new(v))).collect(),
- ))
- })
+ .map(|m| PhpMixed::Array(m.into_iter().collect()))
.collect(),
);
self.funding_info = Some(result_mixed.clone());
@@ -854,7 +848,7 @@ impl GitHubDriver {
let tags_data = response.decode_json()?;
if let PhpMixed::List(ref list) = tags_data {
for tag in list {
- if let PhpMixed::Array(ref tag_map) = **tag {
+ if let PhpMixed::Array(ref tag_map) = *tag {
let name = tag_map
.get("name")
.and_then(|v| v.as_string())
@@ -904,7 +898,7 @@ impl GitHubDriver {
let branch_data = response.decode_json()?;
if let PhpMixed::List(ref list) = branch_data {
for branch in list {
- if let PhpMixed::Array(ref branch_map) = **branch {
+ if let PhpMixed::Array(ref branch_map) = *branch {
let ref_str = branch_map
.get("ref")
.and_then(|v| v.as_string())
@@ -1171,7 +1165,7 @@ impl GitHubDriver {
Ok(response) => {
let data = response.decode_json()?;
self.repo_data = match data {
- PhpMixed::Array(m) => Some(m.into_iter().map(|(k, v)| (k, *v)).collect()),
+ PhpMixed::Array(m) => Some(m),
_ => None,
};
}
diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
index 0bc933e..e0fb72e 100644
--- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs
+++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
@@ -121,8 +121,8 @@ impl GitLabDriver {
self.scheme = if in_array(
PhpMixed::String(scheme_match.clone()),
&PhpMixed::List(vec![
- Box::new(PhpMixed::String("https".to_string())),
- Box::new(PhpMixed::String("http".to_string())),
+ PhpMixed::String("https".to_string()),
+ PhpMixed::String("http".to_string()),
]),
true,
) {
@@ -169,9 +169,9 @@ impl GitLabDriver {
if !in_array(
PhpMixed::String(protocol.to_string()),
&PhpMixed::List(vec![
- Box::new(PhpMixed::String("git".to_string())),
- Box::new(PhpMixed::String("http".to_string())),
- Box::new(PhpMixed::String("https".to_string())),
+ PhpMixed::String("git".to_string()),
+ PhpMixed::String("http".to_string()),
+ PhpMixed::String("https".to_string()),
]),
true,
) {
@@ -274,7 +274,7 @@ impl GitLabDriver {
.unwrap_or_default();
JsonFile::parse_json(Some(&res), None)?
.as_array()
- .map(|m| m.iter().map(|(k, v)| (k.clone(), (**v).clone())).collect())
+ .map(|m| m.clone())
} else {
let file_content = self.get_file_content("composer.json", identifier)?;
let composer = VcsDriverBase::finish_base_composer_information(
@@ -290,13 +290,7 @@ impl GitLabDriver {
c.write(
identifier,
&JsonFile::encode_with_options(
- &PhpMixed::Array(
- composer_map
- .clone()
- .into_iter()
- .map(|(k, v)| (k, Box::new(v)))
- .collect(),
- ),
+ &PhpMixed::Array(composer_map.clone().into_iter().collect()),
JsonEncodeOptions {
pretty_print: false,
..Default::default()
@@ -330,7 +324,7 @@ impl GitLabDriver {
&PhpMixed::Array(
self.get_tags()?
.into_iter()
- .map(|(k, v)| (k, Box::new(PhpMixed::String(v))))
+ .map(|(k, v)| (k, PhpMixed::String(v)))
.collect(),
),
true,
@@ -343,7 +337,7 @@ impl GitLabDriver {
self.get_branches()
.unwrap_or_default()
.into_iter()
- .map(|(k, v)| (k, Box::new(PhpMixed::String(v))))
+ .map(|(k, v)| (k, PhpMixed::String(v)))
.collect(),
),
true,
@@ -363,11 +357,11 @@ impl GitLabDriver {
}) {
support.insert(
"source".to_string(),
- Box::new(PhpMixed::String(format!(
+ PhpMixed::String(format!(
"{}/-/tree/{}",
PhpMixed::String(web_url),
PhpMixed::String(label_str),
- ))),
+ )),
);
}
}
@@ -394,10 +388,7 @@ impl GitLabDriver {
}) {
support.insert(
"issues".to_string(),
- Box::new(PhpMixed::String(format!(
- "{}/-/issues",
- PhpMixed::String(web_url),
- ))),
+ PhpMixed::String(format!("{}/-/issues", PhpMixed::String(web_url),)),
);
}
}
@@ -610,8 +601,8 @@ impl GitLabDriver {
&& !in_array(
PhpMixed::String(character.clone()),
&PhpMixed::List(vec![
- Box::new(PhpMixed::String("-".to_string())),
- Box::new(PhpMixed::String("_".to_string())),
+ PhpMixed::String("-".to_string()),
+ PhpMixed::String("_".to_string()),
]),
true,
) {
@@ -644,7 +635,7 @@ impl GitLabDriver {
if let PhpMixed::List(ref list) = data {
for datum in list {
- if let PhpMixed::Array(ref datum_map) = **datum {
+ if let PhpMixed::Array(ref datum_map) = *datum {
let name = datum_map
.get("name")
.and_then(|v| v.as_string())
@@ -665,10 +656,7 @@ impl GitLabDriver {
.get("commit")
.and_then(|v| v.as_array())
.cloned()
- .unwrap_or_default()
- .into_iter()
- .map(|(k, v)| (k, *v))
- .collect();
+ .unwrap_or_default();
self.commits.insert(commit_id, commit_data);
}
}
@@ -704,7 +692,7 @@ impl GitLabDriver {
.map_err(|e| anyhow::anyhow!("{}", e.message))?
.decode_json()?;
self.project = match project {
- PhpMixed::Array(m) => Some(m.into_iter().map(|(k, v)| (k, *v)).collect()),
+ PhpMixed::Array(m) => Some(m),
_ => None,
};
let project = self.project.clone().unwrap_or_default();
@@ -871,12 +859,7 @@ impl GitLabDriver {
));
}
- if !empty(
- &json_map
- .get("id")
- .cloned()
- .unwrap_or(Box::new(PhpMixed::Null)),
- ) {
+ if !empty(&json_map.get("id").cloned().unwrap_or(PhpMixed::Null)) {
self.is_private = false;
}
diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs
index 6346a84..96a1b38 100644
--- a/crates/shirabe/src/repository/vcs/svn_driver.rs
+++ b/crates/shirabe/src/repository/vcs/svn_driver.rs
@@ -187,9 +187,8 @@ impl SvnDriver {
}
let parsed = JsonFile::parse_json(Some(res.as_str()), None)?;
- let composer: Option<IndexMap<String, PhpMixed>> = parsed
- .as_array()
- .map(|m| m.iter().map(|(k, v)| (k.clone(), (**v).clone())).collect());
+ let composer: Option<IndexMap<String, PhpMixed>> =
+ parsed.as_array().map(|m| m.clone());
self.inner
.info_cache
.insert(identifier.to_string(), composer.clone());
diff --git a/crates/shirabe/src/repository/vcs/vcs_driver.rs b/crates/shirabe/src/repository/vcs/vcs_driver.rs
index ac7496d..249e53f 100644
--- a/crates/shirabe/src/repository/vcs/vcs_driver.rs
+++ b/crates/shirabe/src/repository/vcs/vcs_driver.rs
@@ -75,7 +75,7 @@ impl VcsDriverBase {
.cloned()
.unwrap_or(PhpMixed::Array(IndexMap::new()));
let options: IndexMap<String, PhpMixed> = match options_mixed {
- PhpMixed::Array(a) => a.into_iter().map(|(k, v)| (k, *v)).collect(),
+ PhpMixed::Array(a) => a,
_ => IndexMap::new(),
};
self.http_downloader
@@ -114,10 +114,7 @@ impl VcsDriverBase {
_ => return Ok(None),
};
- // PHP arrays own their nested values; the Rust representation wraps them
- // in Box<PhpMixed>. Unbox the outer level so callers can mutate keys.
- let mut composer: IndexMap<String, PhpMixed> =
- array.into_iter().map(|(k, v)| (k, *v)).collect();
+ let mut composer: IndexMap<String, PhpMixed> = array;
if (!composer.contains_key("time")
|| composer
@@ -153,9 +150,7 @@ impl VcsDriverBase {
&& let Some(res) = self.cache.as_mut().and_then(|c| c.read(identifier))
{
let parsed = JsonFile::parse_json(Some(&res), None)?;
- let composer: Option<IndexMap<String, PhpMixed>> = parsed
- .as_array()
- .map(|m| m.iter().map(|(k, v)| (k.clone(), (**v).clone())).collect());
+ let composer: Option<IndexMap<String, PhpMixed>> = parsed.as_array().map(|m| m.clone());
self.info_cache
.insert(identifier.to_string(), composer.clone());
return Ok(Some(composer));
@@ -219,7 +214,7 @@ pub trait VcsDriver: VcsDriverInterface {
{
let parsed = JsonFile::parse_json(Some(&res), None)?;
let parsed_map: Option<IndexMap<String, PhpMixed>> = match parsed {
- PhpMixed::Array(a) => Some(a.into_iter().map(|(k, v)| (k, *v)).collect()),
+ PhpMixed::Array(a) => Some(a),
_ => None,
};
self.info_cache_mut()
@@ -235,7 +230,7 @@ pub trait VcsDriver: VcsDriverInterface {
let composer_mixed = PhpMixed::Array(
composer_map
.iter()
- .map(|(k, v)| (k.clone(), Box::new(v.clone())))
+ .map(|(k, v)| (k.clone(), v.clone()))
.collect(),
);
let encoded = JsonFile::encode_with_options(
@@ -273,7 +268,7 @@ pub trait VcsDriver: VcsDriverInterface {
)?;
let mut composer: IndexMap<String, PhpMixed> = match composer {
- PhpMixed::Array(a) if !a.is_empty() => a.into_iter().map(|(k, v)| (k, *v)).collect(),
+ PhpMixed::Array(a) if !a.is_empty() => a,
_ => return Ok(None),
};
@@ -313,7 +308,7 @@ pub trait VcsDriver: VcsDriverInterface {
.cloned()
.unwrap_or(PhpMixed::Array(IndexMap::new()));
let options: IndexMap<String, PhpMixed> = match options_mixed {
- PhpMixed::Array(a) => a.into_iter().map(|(k, v)| (k, *v)).collect(),
+ PhpMixed::Array(a) => a,
_ => IndexMap::new(),
};
self.http_downloader()