style: rustfmt squad host + adapter files

Formatting-only. Runs the project formatter over the files authored/edited
this session (host lib+tests, adapter item/squad_ext/squad_projection/mod +
projection test). The intentionally-preserved dirty catalog.rs and
pre-existing /club-era host drift beyond these files are out of scope.
This commit is contained in:
funman300
2026-08-12 03:59:15 +00:00
parent afc909fd3b
commit c2e2e0d8f2
7 changed files with 744 additions and 177 deletions
+29 -7
View File
@@ -87,7 +87,11 @@ fn discard_value(rating: u8) -> i64 {
/// identical by construction. `id` is the owned instance's resolved FIFA
/// identity — pass the resolver's answer for *this* owned copy so two copies of
/// one definition stay distinct on the wire.
pub fn shape_item(item: &CoreOwnedItem, id: Fifa17Identity, ent: &impl ReverseEntityResolver) -> Value {
pub fn shape_item(
item: &CoreOwnedItem,
id: Fifa17Identity,
ent: &impl ReverseEntityResolver,
) -> Value {
let asset = id.asset_id;
let league_id = ent.league_id(&item.league).unwrap_or(0);
let team_id = ent.team_id(&item.club).unwrap_or(0);
@@ -155,13 +159,19 @@ mod tests {
let ent = entities();
let it = shape_item(
&item("oc1", "card_ch_1", 86, "CDM"),
Fifa17Identity { item_id: 100000001, asset_id: 20801 },
Fifa17Identity {
item_id: 100000001,
asset_id: 20801,
},
&ent,
);
assert_eq!(it["id"], 100000001, "wire instance id");
assert_eq!(it["resourceId"], 20801);
assert_eq!(it["assetId"], 20801);
assert_eq!(it["definitionId"], 20801, "version byte 0 => resourceId==assetId==definitionId");
assert_eq!(
it["definitionId"], 20801,
"version byte 0 => resourceId==assetId==definitionId"
);
assert_eq!(it["rating"], 86);
assert_eq!(it["preferredPosition"], "CDM");
assert_eq!(it["leagueId"], 13);
@@ -180,16 +190,28 @@ mod tests {
let ent = entities();
let a = shape_item(
&item("oc-a", "fifa17_101490", 84, "ST"),
Fifa17Identity { item_id: 100000030, asset_id: 101490 },
Fifa17Identity {
item_id: 100000030,
asset_id: 101490,
},
&ent,
);
let b = shape_item(
&item("oc-b", "fifa17_101490", 84, "ST"),
Fifa17Identity { item_id: 100000031, asset_id: 101490 },
Fifa17Identity {
item_id: 100000031,
asset_id: 101490,
},
&ent,
);
assert_eq!(a["resourceId"], b["resourceId"], "same definition => same asset");
assert_ne!(a["id"], b["id"], "distinct owned copies keep distinct wire ids");
assert_eq!(
a["resourceId"], b["resourceId"],
"same definition => same asset"
);
assert_ne!(
a["id"], b["id"],
"distinct owned copies keep distinct wire ids"
);
assert_eq!(a["id"], 100000030);
assert_eq!(b["id"], 100000031);
}