aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/git.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-11 23:28:40 +0900
committernsfisis <nsfisis@gmail.com>2026-08-11 23:28:40 +0900
commit38621c67917fd015f884ea04517791cdc5058c6d (patch)
tree03f466e2db22a3bc45e20e4f9694eb371a59b0e1 /crates/shirabe/src/util/git.rs
parent73ab00d3108933c952844b3820f44230c8203807 (diff)
downloadphp-shirabe-38621c67917fd015f884ea04517791cdc5058c6d.tar.gz
php-shirabe-38621c67917fd015f884ea04517791cdc5058c6d.tar.zst
php-shirabe-38621c67917fd015f884ea04517791cdc5058c6d.zip
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/git.rs')
-rw-r--r--crates/shirabe/src/util/git.rs12
1 files changed, 6 insertions, 6 deletions
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<std::rc::Rc<std::cell::RefCell<dyn IOInterface>>>,
) -> 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<String> = 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 {