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
@@ -73,7 +73,7 @@ impl Default for MetalMoEConfig {
impl MetalMoEConfig {
/// Create a new Metal `MoE` configuration
#[must_use]
#[must_use]
pub fn new(
num_experts: usize,
top_k: usize,
@@ -116,7 +116,7 @@ impl MetalMoEConfig {
}
/// Calculate expert capacity for given batch
#[must_use]
#[must_use]
pub fn calculate_capacity(&self, batch_size: usize, seq_len: usize) -> usize {
let total_tokens = batch_size * seq_len;
let base_capacity = ((total_tokens as f32 * self.capacity_factor) / self.num_experts as f32)
@@ -205,7 +205,7 @@ impl MetalExpert {
}
/// Get parameters
#[must_use]
#[must_use]
pub fn parameters(&self) -> Vec<&Tensor> {
let mut params = vec![&self.up_weight, &self.down_weight];
if let Some(ref b) = self.up_bias {
@@ -373,7 +373,7 @@ impl MetalRouter {
}
/// Get parameters
#[must_use]
#[must_use]
pub fn parameters(&self) -> Vec<&Tensor> {
let mut params = vec![&self.gate_weight];
if let Some(ref b) = self.gate_bias {
@@ -547,31 +547,31 @@ impl MetalMoE {
}
/// Get configuration
#[must_use]
#[must_use]
pub fn config(&self) -> &MetalMoEConfig {
&self.config
}
/// Get router
#[must_use]
#[must_use]
pub fn router(&self) -> &MetalRouter {
&self.router
}
/// Get experts
#[must_use]
#[must_use]
pub fn experts(&self) -> &[MetalExpert] {
&self.experts
}
/// Check if Metal acceleration is active
#[must_use]
#[must_use]
pub fn is_metal_active(&self) -> bool {
self.metal_active
}
/// Get total parameter count
#[must_use]
#[must_use]
pub fn parameter_count(&self) -> usize {
let router_params = self.config.hidden_dim * self.config.num_experts
+ if self.config.bias {