aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/dependency_resolver/rule_set_generator.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-23 23:14:52 +0900
committernsfisis <nsfisis@gmail.com>2026-05-23 23:15:14 +0900
commitdbdecaf5a1c54a876b7ee0153d58dd39b1080f97 (patch)
treef13f2ced03c803dcbc42a5672458b3cb19ff0f30 /crates/shirabe/src/dependency_resolver/rule_set_generator.rs
parentf5b987a00712211b7ce56300851182bda904e97b (diff)
downloadphp-shirabe-dbdecaf5a1c54a876b7ee0153d58dd39b1080f97.tar.gz
php-shirabe-dbdecaf5a1c54a876b7ee0153d58dd39b1080f97.tar.zst
php-shirabe-dbdecaf5a1c54a876b7ee0153d58dd39b1080f97.zip
refactor(semver): change ConstraintInterface to a closed enum
Replace the dyn ConstraintInterface trait objects with an AnyConstraint enum closing over its four implementors (Simple, Multi, MatchAll, MatchNone), mirroring the earlier Rule enum conversion. Rename constraint.rs to simple_constraint.rs to match the renamed Constraint type. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/dependency_resolver/rule_set_generator.rs')
-rw-r--r--crates/shirabe/src/dependency_resolver/rule_set_generator.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/shirabe/src/dependency_resolver/rule_set_generator.rs b/crates/shirabe/src/dependency_resolver/rule_set_generator.rs
index 45f1331..076ce42 100644
--- a/crates/shirabe/src/dependency_resolver/rule_set_generator.rs
+++ b/crates/shirabe/src/dependency_resolver/rule_set_generator.rs
@@ -205,14 +205,14 @@ impl RuleSetGenerator {
}
for link in package.get_requires().values() {
- let mut constraint = link.get_constraint().clone_box();
+ let mut constraint = link.get_constraint().clone();
if platform_requirement_filter.is_ignored(link.get_target()) {
continue;
} else if let Some(ignore_list_filter) = platform_requirement_filter
.as_any()
.downcast_ref::<IgnoreListPlatformRequirementFilter>(
) {
- let fallback = constraint.clone_box();
+ let fallback = constraint.clone();
constraint = ignore_list_filter
.filter_constraint(link.get_target(), constraint, true)
.unwrap_or(fallback);
@@ -221,7 +221,7 @@ impl RuleSetGenerator {
let possible_requires: Vec<Box<dyn PackageInterface>> = self
.pool
.borrow_mut()
- .what_provides(link.get_target(), Some(&*constraint))
+ .what_provides(link.get_target(), Some(&constraint))
.into_iter()
.map(|p| p.clone_package_box())
.collect();
@@ -258,14 +258,14 @@ impl RuleSetGenerator {
continue;
}
- let mut constraint = link.get_constraint().clone_box();
+ let mut constraint = link.get_constraint().clone();
if platform_requirement_filter.is_ignored(link.get_target()) {
continue;
} else if let Some(ignore_list_filter) = platform_requirement_filter
.as_any()
.downcast_ref::<IgnoreListPlatformRequirementFilter>(
) {
- let fallback = constraint.clone_box();
+ let fallback = constraint.clone();
constraint = ignore_list_filter
.filter_constraint(link.get_target(), constraint, false)
.unwrap_or(fallback);
@@ -274,7 +274,7 @@ impl RuleSetGenerator {
let conflicts = self
.pool
.borrow_mut()
- .what_provides(link.get_target(), Some(&*constraint));
+ .what_provides(link.get_target(), Some(&constraint));
for conflict in &conflicts {
// define the conflict rule for regular packages, for alias packages it's only needed if the name
@@ -354,14 +354,14 @@ impl RuleSetGenerator {
}
for (package_name, constraint) in request.get_requires() {
- let mut constraint = constraint.clone_box();
+ let mut constraint = constraint.clone();
if platform_requirement_filter.is_ignored(package_name) {
continue;
} else if let Some(ignore_list_filter) = platform_requirement_filter
.as_any()
.downcast_ref::<IgnoreListPlatformRequirementFilter>(
) {
- let fallback = constraint.clone_box();
+ let fallback = constraint.clone();
constraint = ignore_list_filter
.filter_constraint(package_name, constraint, true)
.unwrap_or(fallback);
@@ -370,7 +370,7 @@ impl RuleSetGenerator {
let packages: Vec<Box<dyn PackageInterface>> = self
.pool
.borrow_mut()
- .what_provides(package_name, Some(&*constraint))
+ .what_provides(package_name, Some(&constraint))
.into_iter()
.map(|p| p.clone_package_box())
.collect();