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:
2026-03-17 10:33:15 +01:00
co-authored by Claude Opus 4.6
parent 7f7706442a
commit aa79dd97e7
84 changed files with 2409 additions and 1339 deletions
+19 -17
View File
@@ -106,10 +106,7 @@ fn malformed_input_produces_sim_error_and_server_continues() {
.expect("not EOF");
let snap1: ObserverSnapshot =
rmp_serde::from_slice(&snap1_bytes).expect("deserialize snapshot 1");
assert!(
snap1.sim_errors.is_empty(),
"no errors expected on tick 1"
);
assert!(snap1.sim_errors.is_empty(), "no errors expected on tick 1");
// --- Tick 2: send malformed input (properly framed but garbage payload) ---
let garbage_payload: Vec<u8> = vec![0xFF, 0xFE, 0xFD, 0xFC, 0xAB, 0xCD, 0xEF];
@@ -132,8 +129,12 @@ fn malformed_input_produces_sim_error_and_server_continues() {
"error kind must be ProtocolError"
);
assert!(
snap2.sim_errors[0].message.contains("Malformed input frame")
|| snap2.sim_errors[0].message.contains("Deserialization error"),
snap2.sim_errors[0]
.message
.contains("Malformed input frame")
|| snap2.sim_errors[0]
.message
.contains("Deserialization error"),
"error message should describe the deserialization failure, got: {}",
snap2.sim_errors[0].message,
);
@@ -161,7 +162,9 @@ fn malformed_input_produces_sim_error_and_server_continues() {
// Clean up
drop(reader);
drop(writer);
server_handle.join().expect("server thread should not panic");
server_handle
.join()
.expect("server thread should not panic");
}
/// State hash is populated in every snapshot and is deterministic for same state.
@@ -206,8 +209,7 @@ fn state_hash_populated_in_snapshot() {
let snap_bytes = read_framed(&mut reader)
.expect("read snapshot")
.expect("not EOF");
let snap: ObserverSnapshot =
rmp_serde::from_slice(&snap_bytes).expect("deserialize snapshot");
let snap: ObserverSnapshot = rmp_serde::from_slice(&snap_bytes).expect("deserialize snapshot");
assert!(
snap.state_hash.is_some(),
@@ -221,7 +223,9 @@ fn state_hash_populated_in_snapshot() {
drop(reader);
drop(writer);
server_handle.join().expect("server thread should not panic");
server_handle
.join()
.expect("server thread should not panic");
}
/// SimError roundtrips through MessagePack serialization.
@@ -296,13 +300,11 @@ fn snapshot_with_sim_errors_roundtrips() {
triangle_crisis_events: vec![],
state_hash: Some(0xDEADBEEF),
debug_response: None,
sim_errors: vec![
SimError {
kind: SimErrorKind::ProtocolError,
message: "bad frame".into(),
tick: 10,
},
],
sim_errors: vec![SimError {
kind: SimErrorKind::ProtocolError,
message: "bad frame".into(),
tick: 10,
}],
current_ticker: None,
settings_response: None,
};