aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-core/src/version_bumper.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-05 17:29:12 +0900
committernsfisis <nsfisis@gmail.com>2026-05-05 17:29:12 +0900
commit49b0884701a84731652fc934d428932ff6029bd4 (patch)
tree7477029b8ed686b9b3b06d960cab2b54ba87b579 /crates/mozart-core/src/version_bumper.rs
parent4623874d1c95414dcd5ae194d2561f2d98b40982 (diff)
downloadphp-mozart-49b0884701a84731652fc934d428932ff6029bd4.tar.gz
php-mozart-49b0884701a84731652fc934d428932ff6029bd4.tar.zst
php-mozart-49b0884701a84731652fc934d428932ff6029bd4.zip
chore: remove redundant comments
Diffstat (limited to 'crates/mozart-core/src/version_bumper.rs')
-rw-r--r--crates/mozart-core/src/version_bumper.rs34
1 files changed, 0 insertions, 34 deletions
diff --git a/crates/mozart-core/src/version_bumper.rs b/crates/mozart-core/src/version_bumper.rs
index 5d6e75e..fc53d53 100644
--- a/crates/mozart-core/src/version_bumper.rs
+++ b/crates/mozart-core/src/version_bumper.rs
@@ -48,8 +48,6 @@ pub fn bump_requirement(
bump_single(constraint_body.trim(), &installed_version, stability_flag)
}
-// ─── OR constraint handling ───────────────────────────────────────────────────
-
fn bump_or_constraint(
constraint_body: &str,
installed_version: &str,
@@ -90,8 +88,6 @@ fn bump_or_constraint(
Some(result)
}
-// ─── Single constraint handling ───────────────────────────────────────────────
-
fn bump_single(
constraint: &str,
installed_version: &str,
@@ -136,8 +132,6 @@ fn bump_single(
None
}
-// ─── Caret bump ───────────────────────────────────────────────────────────────
-
/// `^X.Y.Z` → bump to installed version if it is greater.
///
/// The caret prefix is preserved; segments from installed version replace
@@ -199,8 +193,6 @@ fn bump_caret(rest: &str, installed_version: &str, stability_flag: Option<&str>)
Some(result)
}
-// ─── Tilde bump ───────────────────────────────────────────────────────────────
-
/// `~X.Y.Z` (3 segments) → bump patch: `~X.Y.new_patch`
/// `~X.Y` (2 segments) → convert to caret: `^X.Y.new_patch`
fn bump_tilde(rest: &str, installed_version: &str, stability_flag: Option<&str>) -> Option<String> {
@@ -248,8 +240,6 @@ fn bump_tilde(rest: &str, installed_version: &str, stability_flag: Option<&str>)
Some(result)
}
-// ─── Wildcard bump ────────────────────────────────────────────────────────────
-
/// `*` → `>=installed`
/// `X.*` → `>=installed` (trimming trailing zeros)
fn bump_wildcard(
@@ -301,8 +291,6 @@ fn bump_wildcard(
Some(append_stability_flag(&new_constraint, stability_flag))
}
-// ─── GTE bump ─────────────────────────────────────────────────────────────────
-
/// `>=X.Y` → raise to installed version (trimming trailing zeros)
fn bump_gte(rest: &str, installed_version: &str, stability_flag: Option<&str>) -> Option<String> {
let constraint_segments = parse_version_segments(rest);
@@ -342,8 +330,6 @@ fn bump_gte(rest: &str, installed_version: &str, stability_flag: Option<&str>) -
Some(result)
}
-// ─── AND constraint bump ──────────────────────────────────────────────────
-
/// Bump AND constraints like `>=1.0 <2.0` or `>=1.0,<2.0`.
///
/// Only the lower-bound part (>=, ^, ~) is bumped; upper-bound parts
@@ -425,8 +411,6 @@ fn is_lower_bound(part: &str) -> bool {
part.starts_with(">=") || part.starts_with('^') || part.starts_with('~')
}
-// ─── Helpers ──────────────────────────────────────────────────────────────────
-
/// Strip a trailing `@stability` flag from a constraint string.
/// Returns (body, flag) where flag is the `@...` suffix (without the `@`).
fn strip_stability_flag(constraint: &str) -> (&str, Option<&str>) {
@@ -518,14 +502,10 @@ fn resolve_installed_version<'a>(
.to_string()
}
-// ─── Tests ────────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
- // ── Caret bumps ───────────────────────────────────────────────────────────
-
#[test]
fn test_caret_bump_basic() {
// ^1.0 + 1.2.1 → ^1.2.1
@@ -568,8 +548,6 @@ mod tests {
assert_eq!(result, Some("^1.5".to_string()));
}
- // ── Tilde bumps ───────────────────────────────────────────────────────────
-
#[test]
fn test_tilde_three_segment_bump() {
// ~2.0.0 + 2.0.3 → ~2.0.3
@@ -598,8 +576,6 @@ mod tests {
assert_eq!(result, Some("^2.5".to_string()));
}
- // ── Wildcard bumps ────────────────────────────────────────────────────────
-
#[test]
fn test_wildcard_star() {
// * + 1.2.3 → >=1.2.3
@@ -621,8 +597,6 @@ mod tests {
assert_eq!(result, None);
}
- // ── GTE bumps ─────────────────────────────────────────────────────────────
-
#[test]
fn test_gte_bump() {
// >=1.2 + 1.5.0 → >=1.5
@@ -644,8 +618,6 @@ mod tests {
assert_eq!(result, Some(">=1.5.3".to_string()));
}
- // ── OR constraints ────────────────────────────────────────────────────────
-
#[test]
fn test_or_constraint_bumps_matching_major() {
// ^1.2 || ^2.3 + 1.3.0 → ^1.3 || ^2.3
@@ -667,8 +639,6 @@ mod tests {
assert_eq!(result, None);
}
- // ── Dev constraints ───────────────────────────────────────────────────────
-
#[test]
fn test_dev_constraint_unchanged() {
// dev-master → None
@@ -690,8 +660,6 @@ mod tests {
assert_eq!(result, Some("^1.2".to_string()));
}
- // ── Stability flags ───────────────────────────────────────────────────────
-
#[test]
fn test_stability_flag_preserved() {
// ^1.0@dev + 1.2.0 → ^1.2@dev
@@ -706,8 +674,6 @@ mod tests {
assert_eq!(result, Some("^1.2.1@beta".to_string()));
}
- // ── Edge cases ────────────────────────────────────────────────────────────
-
#[test]
fn test_exact_constraint_no_bump() {
// 1.2.3 → None (exact version, not bumped)