diff options
Diffstat (limited to 'crates/shirabe/src/package')
| -rw-r--r-- | crates/shirabe/src/package/alias_package.rs | 12 | ||||
| -rw-r--r-- | crates/shirabe/src/package/locker.rs | 20 |
2 files changed, 11 insertions, 21 deletions
diff --git a/crates/shirabe/src/package/alias_package.rs b/crates/shirabe/src/package/alias_package.rs index fb775130..088cd6ab 100644 --- a/crates/shirabe/src/package/alias_package.rs +++ b/crates/shirabe/src/package/alias_package.rs @@ -11,7 +11,7 @@ use crate::repository::RepositoryInterfaceWeakHandle; use chrono::{DateTime, Utc}; use indexmap::IndexMap; use indexmap::IndexSet; -use shirabe_php_shim::{LogicException, PhpMixed, in_array_strict}; +use shirabe_php_shim::{LogicException, PhpMixed}; use shirabe_semver::constraint::SimpleConstraint; #[derive(Debug, Clone)] @@ -131,13 +131,9 @@ impl AliasPackage { pretty_version = self.alias_of.get_pretty_version(); } - if in_array_strict( - link_type.to_string(), - &[ - PhpMixed::String(Link::TYPE_CONFLICT.to_string()), - PhpMixed::String(Link::TYPE_PROVIDE.to_string()), - PhpMixed::String(Link::TYPE_REPLACE.to_string()), - ], + if matches!( + link_type, + Link::TYPE_CONFLICT | Link::TYPE_PROVIDE | Link::TYPE_REPLACE ) { let mut new_links: Vec<Link> = vec![]; for link in links.values() { diff --git a/crates/shirabe/src/package/locker.rs b/crates/shirabe/src/package/locker.rs index 10350d78..a4d28861 100644 --- a/crates/shirabe/src/package/locker.rs +++ b/crates/shirabe/src/package/locker.rs @@ -29,7 +29,7 @@ use shirabe_external_packages::seld::json_lint::ParsingException; use shirabe_php_shim::{ DATE_RFC3339, LogicException, PhpMixed, RuntimeException, array_intersect, array_keys, array_map, array_merge, file_get_contents, filemtime, function_exists, hash, in_array_loose, - in_array_strict, is_int, ksort, php_regex, realpath, strcmp, strtolower, touch2, trim, usort, + is_int, ksort, php_regex, realpath, strcmp, strtolower, touch2, trim, usort, }; /// Reads/writes project lockfile (composer.lock). @@ -476,18 +476,12 @@ impl Locker { let aliases: Vec<IndexMap<String, PhpMixed>> = array_map( |alias: &IndexMap<String, PhpMixed>| { let mut alias = alias.clone(); - let version = alias - .get("version") - .and_then(|v| v.as_string()) - .unwrap_or("") - .to_string(); - if in_array_strict( - version, - &[ - PhpMixed::String("dev-master".to_string()), - PhpMixed::String("dev-trunk".to_string()), - PhpMixed::String("dev-default".to_string()), - ], + if matches!( + alias + .get("version") + .and_then(|v| v.as_string()) + .unwrap_or(""), + "dev-master" | "dev-trunk" | "dev-default" ) { alias.insert( "version".to_string(), |
