style: apply rustfmt across all crates and demos

Consistent formatting pass: line wrapping, import sorting, trailing
whitespace removal, let-chain indentation, merged derive attributes,
and unsafe block reformatting.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This commit is contained in:
osobh
2026-04-12 07:01:58 -07:00
co-authored by Claude Opus 4.6
parent bc88a14fa1
commit 02d382d5f6
302 changed files with 1805 additions and 1590 deletions
@@ -107,19 +107,19 @@ impl CosineAnnealingScheduler {
}
/// Get the minimum learning rate
#[must_use]
#[must_use]
pub fn min_lr(&self) -> f64 {
self.min_lr
}
/// Get the cycle length
#[must_use]
#[must_use]
pub fn t_max(&self) -> usize {
self.t_max
}
/// Check if using warm restarts
#[must_use]
#[must_use]
pub fn use_restarts(&self) -> bool {
self.use_restarts
}
@@ -127,7 +127,7 @@ impl CosineAnnealingScheduler {
/// Get the current cycle number (0-indexed)
///
/// Each cycle contains `t_max` + 1 steps (from 0 to `t_max` inclusive).
#[must_use]
#[must_use]
pub fn current_cycle(&self, step: usize) -> usize {
if self.use_restarts {
step / (self.t_max + 1)
@@ -142,7 +142,7 @@ impl CosineAnnealingScheduler {
/// - Steps 0 to `t_max` form one complete cycle (`t_max` + 1 total steps)
/// - At step `t_max`, LR reaches `min_lr`
/// - At step `t_max` + 1, a new cycle begins at `base_lr`
#[must_use]
#[must_use]
pub fn cycle_step(&self, step: usize) -> usize {
if self.use_restarts {
// Use t_max + 1 as period so step t_max is end of cycle (min_lr)
@@ -154,7 +154,7 @@ impl CosineAnnealingScheduler {
}
/// Get the progress within the current cycle (0.0 to 1.0)
#[must_use]
#[must_use]
pub fn cycle_progress(&self, step: usize) -> f64 {
let cycle_step = self.cycle_step(step);
cycle_step as f64 / self.t_max as f64