fix(simulation): Clippy cleanup and CI enforcement (#635)
Fix all Clippy warnings across the server codebase (2411 insertions, 1341 deletions). Raise type-complexity-threshold to 750 and too-many-arguments to 12 in .clippy.toml for idiomatic Bevy ECS system signatures. The server now passes `cargo clippy -- --deny warnings` cleanly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -115,14 +115,20 @@ pub fn probe_hardware(mode: Option<ResourceMode>) -> HardwareProbe {
|
||||
tracing::warn!("GPU mode set but VRAM probe failed — falling back to system RAM");
|
||||
let mut sys = System::new_all();
|
||||
sys.refresh_memory();
|
||||
(sys.total_memory() / (1024 * 1024), sys.available_memory() / (1024 * 1024))
|
||||
(
|
||||
sys.total_memory() / (1024 * 1024),
|
||||
sys.available_memory() / (1024 * 1024),
|
||||
)
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// CPU mode or Apple Silicon (unified memory = system RAM)
|
||||
let mut sys = System::new_all();
|
||||
sys.refresh_memory();
|
||||
(sys.total_memory() / (1024 * 1024), sys.available_memory() / (1024 * 1024))
|
||||
(
|
||||
sys.total_memory() / (1024 * 1024),
|
||||
sys.available_memory() / (1024 * 1024),
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -228,7 +234,10 @@ pub enum ScalingDecision {
|
||||
/// Returns (total_mb, free_mb) for the first GPU, or None.
|
||||
fn probe_nvidia_vram() -> Option<(u64, u64)> {
|
||||
let output = Command::new("nvidia-smi")
|
||||
.args(["--query-gpu=memory.total,memory.free", "--format=csv,noheader,nounits"])
|
||||
.args([
|
||||
"--query-gpu=memory.total,memory.free",
|
||||
"--format=csv,noheader,nounits",
|
||||
])
|
||||
.output()
|
||||
.ok()?;
|
||||
|
||||
@@ -480,9 +489,9 @@ mod tests {
|
||||
fn evaluate_scaling_hold_when_calm() {
|
||||
let decision = evaluate_scaling(
|
||||
ResourceMode::Cpu,
|
||||
2, // running
|
||||
5, // queue depth (low)
|
||||
1, // active
|
||||
2, // running
|
||||
5, // queue depth (low)
|
||||
1, // active
|
||||
None,
|
||||
);
|
||||
assert!(matches!(decision, ScalingDecision::Hold));
|
||||
|
||||
Reference in New Issue
Block a user