Skip to content

Commit 85d217a

Browse files
alanbldclaude
andcommitted
style: apply rustfmt formatting
Fix CI formatting check failure. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent cdb7fac commit 85d217a

File tree

5 files changed

+64
-26
lines changed

5 files changed

+64
-26
lines changed

crates/utf8proj-cli/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2074,7 +2074,13 @@ fn cmd_init(name: &str, output_dir: Option<&std::path::Path>) -> Result<()> {
20742074
// Sanitize project name for filename (replace spaces/special chars with underscores)
20752075
let filename: String = name
20762076
.chars()
2077-
.map(|c| if c.is_alphanumeric() || c == '-' || c == '_' { c } else { '_' })
2077+
.map(|c| {
2078+
if c.is_alphanumeric() || c == '-' || c == '_' {
2079+
c
2080+
} else {
2081+
'_'
2082+
}
2083+
})
20782084
.collect();
20792085
let filepath = dir.join(format!("{}.proj", filename));
20802086

crates/utf8proj-cli/tests/init_command.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ fn init_creates_project_file() {
2828
assert!(output.status.success(), "Command should succeed");
2929
let stdout = String::from_utf8_lossy(&output.stdout);
3030
assert!(stdout.contains("Created:"), "Should show 'Created:'");
31-
assert!(
32-
stdout.contains("test-project.proj"),
33-
"Should show filename"
34-
);
31+
assert!(stdout.contains("test-project.proj"), "Should show filename");
3532
assert!(expected_file.exists(), "File should be created");
3633

3734
// Verify content has expected structure
@@ -110,7 +107,10 @@ fn init_generated_file_schedules() {
110107

111108
assert!(output.status.success(), "schedule should succeed");
112109
let stdout = String::from_utf8_lossy(&output.stdout);
113-
assert!(stdout.contains("Critical Path:"), "Should show critical path");
110+
assert!(
111+
stdout.contains("Critical Path:"),
112+
"Should show critical path"
113+
);
114114
}
115115

116116
#[test]

crates/utf8proj-core/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,10 @@ impl std::str::FromStr for TemporalRegime {
11941194
"work" => Ok(TemporalRegime::Work),
11951195
"event" => Ok(TemporalRegime::Event),
11961196
"deadline" => Ok(TemporalRegime::Deadline),
1197-
_ => Err(format!("unknown regime: '{}' (expected: work, event, deadline)", s)),
1197+
_ => Err(format!(
1198+
"unknown regime: '{}' (expected: work, event, deadline)",
1199+
s
1200+
)),
11981201
}
11991202
}
12001203
}

crates/utf8proj-solver/src/lib.rs

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,9 +2950,13 @@ impl Scheduler for CpmSolver {
29502950
date_to_working_days(project.start, *date, &calendar);
29512951
es = es.max(constraint_days);
29522952
} else {
2953-
let effective_date = advance_to_working_day(*date, &calendar);
2954-
let constraint_days =
2955-
date_to_working_days(project.start, effective_date, &calendar);
2953+
let effective_date =
2954+
advance_to_working_day(*date, &calendar);
2955+
let constraint_days = date_to_working_days(
2956+
project.start,
2957+
effective_date,
2958+
&calendar,
2959+
);
29562960
es = es.max(constraint_days);
29572961
}
29582962
}
@@ -2965,9 +2969,13 @@ impl Scheduler for CpmSolver {
29652969
date_to_working_days(project.start, *date, &calendar);
29662970
es = es.max(constraint_days);
29672971
} else {
2968-
let effective_date = advance_to_working_day(*date, &calendar);
2969-
let constraint_days =
2970-
date_to_working_days(project.start, effective_date, &calendar);
2972+
let effective_date =
2973+
advance_to_working_day(*date, &calendar);
2974+
let constraint_days = date_to_working_days(
2975+
project.start,
2976+
effective_date,
2977+
&calendar,
2978+
);
29712979
es = es.max(constraint_days);
29722980
}
29732981
}
@@ -2979,15 +2987,21 @@ impl Scheduler for CpmSolver {
29792987
date_to_working_days(project.start, *date, &calendar);
29802988
let exclusive_ef = constraint_days + 1;
29812989
min_finish = Some(
2982-
min_finish.map_or(exclusive_ef, |mf| mf.max(exclusive_ef)),
2990+
min_finish
2991+
.map_or(exclusive_ef, |mf| mf.max(exclusive_ef)),
29832992
);
29842993
} else {
2985-
let effective_date = advance_to_working_day(*date, &calendar);
2986-
let constraint_days =
2987-
date_to_working_days(project.start, effective_date, &calendar);
2994+
let effective_date =
2995+
advance_to_working_day(*date, &calendar);
2996+
let constraint_days = date_to_working_days(
2997+
project.start,
2998+
effective_date,
2999+
&calendar,
3000+
);
29883001
let exclusive_ef = constraint_days + 1;
29893002
min_finish = Some(
2990-
min_finish.map_or(exclusive_ef, |mf| mf.max(exclusive_ef)),
3003+
min_finish
3004+
.map_or(exclusive_ef, |mf| mf.max(exclusive_ef)),
29913005
);
29923006
}
29933007
}
@@ -2999,15 +3013,21 @@ impl Scheduler for CpmSolver {
29993013
date_to_working_days(project.start, *date, &calendar);
30003014
let exclusive_ef = constraint_days + 1;
30013015
min_finish = Some(
3002-
min_finish.map_or(exclusive_ef, |mf| mf.max(exclusive_ef)),
3016+
min_finish
3017+
.map_or(exclusive_ef, |mf| mf.max(exclusive_ef)),
30033018
);
30043019
} else {
3005-
let effective_date = advance_to_working_day(*date, &calendar);
3006-
let constraint_days =
3007-
date_to_working_days(project.start, effective_date, &calendar);
3020+
let effective_date =
3021+
advance_to_working_day(*date, &calendar);
3022+
let constraint_days = date_to_working_days(
3023+
project.start,
3024+
effective_date,
3025+
&calendar,
3026+
);
30083027
let exclusive_ef = constraint_days + 1;
30093028
min_finish = Some(
3010-
min_finish.map_or(exclusive_ef, |mf| mf.max(exclusive_ef)),
3029+
min_finish
3030+
.map_or(exclusive_ef, |mf| mf.max(exclusive_ef)),
30113031
);
30123032
}
30133033
}
@@ -4022,7 +4042,10 @@ mod tests {
40224042
let schedule = solver.schedule(&project).unwrap();
40234043

40244044
// Both tasks should be critical (linear chain)
4025-
assert!(schedule.tasks["work"].is_critical, "work should be critical");
4045+
assert!(
4046+
schedule.tasks["work"].is_critical,
4047+
"work should be critical"
4048+
);
40264049
assert!(
40274050
schedule.tasks["release"].is_critical,
40284051
"milestone should be critical when it has zero slack"

crates/utf8proj-solver/tests/temporal_regimes.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ fn event_regime_on_non_milestone_task() {
5858
.diagnostics
5959
.iter()
6060
.any(|d| d.code == DiagnosticCode::R001EventNonZeroDuration);
61-
assert!(has_r001, "Expected R001 diagnostic for Event task with duration");
61+
assert!(
62+
has_r001,
63+
"Expected R001 diagnostic for Event task with duration"
64+
);
6265
}
6366

6467
// =============================================================================
@@ -325,7 +328,10 @@ fn no_r001_for_zero_duration_event() {
325328
.diagnostics
326329
.iter()
327330
.any(|d| d.code == DiagnosticCode::R001EventNonZeroDuration);
328-
assert!(!has_r001, "Should not emit R001 for zero-duration Event task");
331+
assert!(
332+
!has_r001,
333+
"Should not emit R001 for zero-duration Event task"
334+
);
329335
}
330336

331337
// =============================================================================

0 commit comments

Comments
 (0)