aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-semver/src/constraint
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-17 02:53:53 +0900
committernsfisis <nsfisis@gmail.com>2026-05-17 02:53:53 +0900
commita1c7e6908a26e10f6e1f23a51721664b5e2d838d (patch)
treec575c76f1b43359ed74913da4c6a2636643f1ba0 /crates/shirabe-semver/src/constraint
parent7f606f36fef0c0467c3c0db3d0da33af486dae8a (diff)
downloadphp-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.tar.gz
php-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.tar.zst
php-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.zip
chore(style): cargo fmt
Diffstat (limited to 'crates/shirabe-semver/src/constraint')
-rw-r--r--crates/shirabe-semver/src/constraint/constraint.rs22
-rw-r--r--crates/shirabe-semver/src/constraint/multi_constraint.rs13
2 files changed, 15 insertions, 20 deletions
diff --git a/crates/shirabe-semver/src/constraint/constraint.rs b/crates/shirabe-semver/src/constraint/constraint.rs
index e35b3e4..b0c937c 100644
--- a/crates/shirabe-semver/src/constraint/constraint.rs
+++ b/crates/shirabe-semver/src/constraint/constraint.rs
@@ -131,26 +131,17 @@ impl Constraint {
if self.version.starts_with("dev-") {
if Self::OP_EQ == self.operator {
if Self::OP_EQ == other_operator {
- return format!(
- "$b && $v === {}",
- php::var_export_str(&self.version, true)
- );
+ return format!("$b && $v === {}", php::var_export_str(&self.version, true));
}
if Self::OP_NE == other_operator {
- return format!(
- "!$b || $v !== {}",
- php::var_export_str(&self.version, true)
- );
+ return format!("!$b || $v !== {}", php::var_export_str(&self.version, true));
}
return "false".to_string();
}
if Self::OP_NE == self.operator {
if Self::OP_EQ == other_operator {
- return format!(
- "!$b || $v !== {}",
- php::var_export_str(&self.version, true)
- );
+ return format!("!$b || $v !== {}", php::var_export_str(&self.version, true));
}
if Self::OP_NE == other_operator {
return "true".to_string();
@@ -276,7 +267,12 @@ impl Constraint {
};
if self
- .version_compare(version1, version2, Self::trans_op_int(operator), compare_branches)
+ .version_compare(
+ version1,
+ version2,
+ Self::trans_op_int(operator),
+ compare_branches,
+ )
.expect("valid operator")
{
return !(Self::trans_op_int(provider.operator) == provider_no_equal_op
diff --git a/crates/shirabe-semver/src/constraint/multi_constraint.rs b/crates/shirabe-semver/src/constraint/multi_constraint.rs
index ff7fbfb..86afa8d 100644
--- a/crates/shirabe-semver/src/constraint/multi_constraint.rs
+++ b/crates/shirabe-semver/src/constraint/multi_constraint.rs
@@ -108,7 +108,9 @@ impl MultiConstraint {
conjunctive: bool,
) -> anyhow::Result<Box<dyn ConstraintInterface>> {
if constraints.is_empty() {
- return Ok(Box::new(MatchAllConstraint { pretty_string: None }));
+ return Ok(Box::new(MatchAllConstraint {
+ pretty_string: None,
+ }));
}
if constraints.len() == 1 {
@@ -170,7 +172,8 @@ impl MultiConstraint {
true,
)
.unwrap(),
- ) as Box<dyn ConstraintInterface>)
+ )
+ as Box<dyn ConstraintInterface>)
} else {
None
}
@@ -280,11 +283,7 @@ impl ConstraintInterface for MultiConstraint {
return s.clone();
}
- let parts: Vec<String> = self
- .constraints
- .iter()
- .map(|c| c.__to_string())
- .collect();
+ let parts: Vec<String> = self.constraints.iter().map(|c| c.__to_string()).collect();
let sep = if self.conjunctive { " " } else { " || " };
let result = format!("[{}]", parts.join(sep));