From 9e5bb3e4253dda96345f4d1a3421077a72295048 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 15 Aug 2026 09:10:16 +0900 Subject: refactor(php-shim): take only the data argument in http_build_query `http_build_query` ignores `numeric_prefix` because a string-keyed slice never holds an integer key, and every caller passes `"&"` as the separator. Drop both parameters and hard-code the separator. Callers that pass a map of scalar literals to `http_build_query_mixed` no longer need to build an `IndexMap` for it, so move them to the slice form. Co-Authored-By: Claude Opus 5 (1M context) --- .../src/repository/vcs/git_bitbucket_driver.rs | 62 +++++----------------- 1 file changed, 12 insertions(+), 50 deletions(-) (limited to 'crates/shirabe/src/repository') diff --git a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs index eb64c4f8..c3da08ff 100644 --- a/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs +++ b/crates/shirabe/src/repository/vcs/git_bitbucket_driver.rs @@ -19,8 +19,7 @@ use shirabe_pcre::{CaptureKey, Preg}; use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ InvalidArgumentException, LogicException, PhpMixed, RuntimeException, array_key_exists, - array_search_mixed, extension_loaded, http_build_query_mixed, implode, is_array, php_regex, - strpos, + array_search_mixed, extension_loaded, http_build_query, implode, is_array, php_regex, strpos, }; #[derive(Debug)] @@ -152,18 +151,7 @@ impl GitBitbucketDriver { "https://api.bitbucket.org/2.0/repositories/{}/{}?{}", self.owner.clone(), self.repository.clone(), - http_build_query_mixed( - &{ - let mut m: IndexMap = IndexMap::new(); - m.insert( - "fields".to_string(), - PhpMixed::String("-project,-owner".to_string()), - ); - m - }, - "", - "&", - ), + http_build_query(&[("fields", "-project,-owner")]), ); let repo_data = self @@ -524,23 +512,11 @@ impl GitBitbucketDriver { let mut resource = format!( "{}?{}", self.tags_url.clone(), - http_build_query_mixed( - &{ - let mut m: IndexMap = IndexMap::new(); - m.insert("pagelen".to_string(), PhpMixed::Int(100)); - m.insert( - "fields".to_string(), - PhpMixed::String("values.name,values.target.hash,next".to_string()), - ); - m.insert( - "sort".to_string(), - PhpMixed::String("-target.date".to_string()), - ); - m - }, - "", - "&", - ), + http_build_query(&[ + ("pagelen", "100"), + ("fields", "values.name,values.target.hash,next"), + ("sort", "-target.date"), + ]), ); let mut has_next = true; while has_next { @@ -603,25 +579,11 @@ impl GitBitbucketDriver { let mut resource = format!( "{}?{}", self.branches_url.clone(), - http_build_query_mixed( - &{ - let mut m: IndexMap = IndexMap::new(); - m.insert("pagelen".to_string(), PhpMixed::Int(100)); - m.insert( - "fields".to_string(), - PhpMixed::String( - "values.name,values.target.hash,values.heads,next".to_string(), - ), - ); - m.insert( - "sort".to_string(), - PhpMixed::String("-target.date".to_string()), - ); - m - }, - "", - "&", - ), + http_build_query(&[ + ("pagelen", "100"), + ("fields", "values.name,values.target.hash,values.heads,next"), + ("sort", "-target.date"), + ]), ); let mut has_next = true; while has_next { -- cgit v1.3.1-4-g156e