diff options
Diffstat (limited to 'crates/shirabe/src/util')
| -rw-r--r-- | crates/shirabe/src/util/filesystem.rs | 9 | ||||
| -rw-r--r-- | crates/shirabe/src/util/git.rs | 12 | ||||
| -rw-r--r-- | crates/shirabe/src/util/platform.rs | 6 |
3 files changed, 12 insertions, 15 deletions
diff --git a/crates/shirabe/src/util/filesystem.rs b/crates/shirabe/src/util/filesystem.rs index b46e7913..2db41238 100644 --- a/crates/shirabe/src/util/filesystem.rs +++ b/crates/shirabe/src/util/filesystem.rs @@ -9,9 +9,8 @@ use shirabe_php_shim::{ clearstatcache, clearstatcache2, copy, dirname, explode, fclose, feof, file_exists, file_get_contents, file_put_contents, fileatime, filemtime, filesize, fopen, fread, function_exists, fwrite, implode, is_dir, is_file, is_link, is_readable, lstat, mkdir, - php_regex, rename, rmdir, rtrim, str_contains, str_repeat, str_replace, str_starts_with, - strlen, strpos, strtoupper, strtr, substr, substr_count, symlink, touch, unlink, usleep, - var_export, + php_regex, rename, rmdir, rtrim, str_repeat, str_replace, strlen, strpos, strtoupper, strtr, + substr, substr_count, symlink, touch, unlink, usleep, var_export, }; use shirabe_symfony_filesystem::exception::IOException; use shirabe_symfony_finder::Finder; @@ -431,7 +430,7 @@ impl Filesystem { // if copy fails we attempt to copy it manually as this can help bypass issues with VirtualBox shared folders // see https://github.com/composer/composer/issues/12057 - if str_contains(e.get_message(), "Bad address") { + if e.get_message().contains("Bad address") { let (source_handle, target_handle) = match (fopen(source, "r"), fopen(&target, "w")) { (Ok(source_handle), Ok(target_handle)) => { @@ -648,7 +647,7 @@ impl Filesystem { } common_path = format!("{}/", rtrim(&common_path, Some("/"))); - if str_starts_with(&to, &format!("{}/", from)) { + if to.starts_with(&format!("{}/", from)) { return format!( "__DIR__ . {}", var_export(&PhpMixed::String(substr(&to, strlen(&from), None)), true) 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 { diff --git a/crates/shirabe/src/util/platform.rs b/crates/shirabe/src/util/platform.rs index 596a634b..ccdd30b6 100644 --- a/crates/shirabe/src/util/platform.rs +++ b/crates/shirabe/src/util/platform.rs @@ -237,9 +237,7 @@ impl Platform { None => continue, }; // detect default mount points created by Docker/containerd - if shirabe_php_shim::str_contains(&data, "/var/lib/docker/") - || shirabe_php_shim::str_contains(&data, "/io.containerd.snapshotter") - { + if data.contains("/var/lib/docker/") || data.contains("/io.containerd.snapshotter") { *cached = Some(true); return true; } @@ -357,7 +355,7 @@ impl Platform { let mut output = String::new(); let result: anyhow::Result<()> = (|| { if process.execute_args(&["lsmod".to_string()], &mut output, None) == 0 - && shirabe_php_shim::str_contains(&output, "vboxguest") + && output.contains("vboxguest") { *cached = Some(true); return Ok(()); |
