From 38621c67917fd015f884ea04517791cdc5058c6d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 11 Aug 2026 23:28:40 +0900 Subject: chore(php-shim): drop the substring predicate ports str_contains(), str_starts_with() and str_ends_with() were thin wrappers over the str methods of the same semantics. Call sites now use contains()/starts_with()/ends_with() directly. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/util/git.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/shirabe/src/util/git.rs') diff --git a/crates/shirabe/src/util/git.rs b/crates/shirabe/src/util/git.rs index c92847a2..26ea1898 100644 --- a/crates/shirabe/src/util/git.rs +++ b/crates/shirabe/src/util/git.rs @@ -18,8 +18,8 @@ use shirabe_pcre::{CaptureKey, Preg}; use shirabe_php_shim::{ AnyThrowable, CmpOp, InvalidArgumentException, PHP_EOL, PhpMixed, RuntimeException, array_map, clearstatcache, explode, implode, in_array_loose, in_array_strict, is_dir, php_regex, - preg_quote, rawurldecode, rawurlencode, str_contains, str_ends_with, str_replace_array, strlen, - strpos, substr, trim, version_compare, + preg_quote, rawurldecode, rawurlencode, str_replace_array, strlen, strpos, substr, trim, + version_compare, }; use std::sync::Mutex; @@ -57,7 +57,7 @@ impl Git { path: &str, io: Option>>, ) -> anyhow::Result<()> { - if str_contains(output, "fatal: detected dubious ownership") { + if output.contains("fatal: detected dubious ownership") { let msg = format!( "The repository at \"{}\" does not have the correct ownership and git refuses to use it:{}{}{}", path, PHP_EOL, PHP_EOL, output @@ -431,7 +431,7 @@ impl Git { let domain = m.get(&CaptureKey::ByIndex(2)).cloned().unwrap_or_default(); let mut repo_with_git_part = m.get(&CaptureKey::ByIndex(3)).cloned().unwrap_or_default(); - if !str_ends_with(&repo_with_git_part, ".git") { + if !repo_with_git_part.ends_with(".git") { repo_with_git_part.push_str(".git"); } if !self.io.has_authentication(&domain) { @@ -651,7 +651,7 @@ impl Git { let mut m2 = m.get(&CaptureKey::ByIndex(2)).cloned().unwrap_or_default(); let m3 = m.get(&CaptureKey::ByIndex(3)).cloned().unwrap_or_default(); let mut auth_parts: Option = None; - if str_contains(&m2, "@") { + if m2.contains("@") { let parts = explode("@", &m2); auth_parts = parts.first().cloned(); m2 = parts.get(1).cloned().unwrap_or_default(); @@ -665,7 +665,7 @@ impl Git { if let Some(ref parts) = auth_parts && !parts.is_empty() { - if str_contains(parts, ":") { + if parts.contains(":") { let split = explode(":", parts); default_username = split.first().cloned(); } else { -- cgit v1.3.1-4-g156e