diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-23 23:14:52 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-23 23:15:14 +0900 |
| commit | dbdecaf5a1c54a876b7ee0153d58dd39b1080f97 (patch) | |
| tree | f13f2ced03c803dcbc42a5672458b3cb19ff0f30 /crates/shirabe/src/package/version/version_bumper.rs | |
| parent | f5b987a00712211b7ce56300851182bda904e97b (diff) | |
| download | php-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/package/version/version_bumper.rs')
| -rw-r--r-- | crates/shirabe/src/package/version/version_bumper.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/shirabe/src/package/version/version_bumper.rs b/crates/shirabe/src/package/version/version_bumper.rs index a9b5a67..8cc4b5d 100644 --- a/crates/shirabe/src/package/version/version_bumper.rs +++ b/crates/shirabe/src/package/version/version_bumper.rs @@ -8,7 +8,7 @@ use crate::util::Platform; use anyhow::Result; use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; -use shirabe_semver::constraint::ConstraintInterface; +use shirabe_semver::constraint::AnyConstraint; use shirabe_semver::intervals::Intervals; #[derive(Debug)] @@ -17,7 +17,7 @@ pub struct VersionBumper; impl VersionBumper { pub fn bump_requirement( &self, - constraint: &dyn ConstraintInterface, + constraint: &AnyConstraint, package: &dyn PackageInterface, ) -> Result<String> { let parser = VersionParser::new(); @@ -114,8 +114,8 @@ impl VersionBumper { } let new_constraint = parser.parse_constraints(&modified)?; - if Intervals::is_subset_of(new_constraint.as_ref(), constraint)? - && Intervals::is_subset_of(constraint, new_constraint.as_ref())? + if Intervals::is_subset_of(&new_constraint, constraint)? + && Intervals::is_subset_of(constraint, &new_constraint)? { return Ok(pretty_constraint); } |
