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:
@@ -51,7 +51,10 @@ pub struct WireItemRef {
|
||||
|
||||
impl From<&SquadEntityRef> for WireItemRef {
|
||||
fn from(r: &SquadEntityRef) -> Self {
|
||||
WireItemRef { id: r.id, dream: r.dream }
|
||||
WireItemRef {
|
||||
id: r.id,
|
||||
dream: r.dream,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +138,10 @@ impl Fifa17SquadExtensionV1 {
|
||||
.iter()
|
||||
.map(|k| KicktakerRef {
|
||||
index: k.index,
|
||||
item: WireItemRef { id: k.id, dream: k.dream },
|
||||
item: WireItemRef {
|
||||
id: k.id,
|
||||
dream: k.dream,
|
||||
},
|
||||
})
|
||||
.collect(),
|
||||
client_reported: ClientReportedSquadEval {
|
||||
@@ -213,16 +219,23 @@ pub fn build_squad_write(
|
||||
) -> Result<SquadWriteBuild, SquadBuildError> {
|
||||
let canonical = crate::fut::squad::to_proposed(put, resolver);
|
||||
if !canonical.unresolved_wire_ids.is_empty() {
|
||||
return Err(SquadBuildError::UnresolvedWireIds(canonical.unresolved_wire_ids.clone()));
|
||||
return Err(SquadBuildError::UnresolvedWireIds(
|
||||
canonical.unresolved_wire_ids.clone(),
|
||||
));
|
||||
}
|
||||
let mut seen = std::collections::HashSet::new();
|
||||
for slot in &canonical.slots {
|
||||
if !seen.insert(slot.owned_card_id.as_str()) {
|
||||
return Err(SquadBuildError::DuplicateOwnedItem(slot.owned_card_id.clone()));
|
||||
return Err(SquadBuildError::DuplicateOwnedItem(
|
||||
slot.owned_card_id.clone(),
|
||||
));
|
||||
}
|
||||
}
|
||||
let extension = Fifa17SquadExtensionV1::from_put(put, &canonical);
|
||||
Ok(SquadWriteBuild { canonical, extension })
|
||||
Ok(SquadWriteBuild {
|
||||
canonical,
|
||||
extension,
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -266,7 +279,8 @@ mod tests {
|
||||
let ext = built().extension;
|
||||
assert_eq!(ext.custom, put.custom, "opaque custom carried verbatim");
|
||||
// survives a serialize/parse cycle unchanged.
|
||||
let back = Fifa17SquadExtensionV1::from_payload(EXT_SCHEMA_VERSION, &ext.to_payload()).unwrap();
|
||||
let back =
|
||||
Fifa17SquadExtensionV1::from_payload(EXT_SCHEMA_VERSION, &ext.to_payload()).unwrap();
|
||||
assert_eq!(back.custom, put.custom);
|
||||
}
|
||||
|
||||
@@ -285,14 +299,24 @@ mod tests {
|
||||
let ext = built().extension;
|
||||
assert_eq!(
|
||||
ext.client_reported,
|
||||
ClientReportedSquadEval { chemistry: Some(52), rating: Some(90), star_rating: Some(90) }
|
||||
ClientReportedSquadEval {
|
||||
chemistry: Some(52),
|
||||
rating: Some(90),
|
||||
star_rating: Some(90)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn manager_and_kicktakers_preserved_opaquely() {
|
||||
let ext = built().extension;
|
||||
assert_eq!(ext.manager, vec![WireItemRef { id: 100000427, dream: false }]);
|
||||
assert_eq!(
|
||||
ext.manager,
|
||||
vec![WireItemRef {
|
||||
id: 100000427,
|
||||
dream: false
|
||||
}]
|
||||
);
|
||||
assert_eq!(ext.kicktakers.len(), 5);
|
||||
// All five reference the same wire id in this capture; carried verbatim,
|
||||
// NEVER normalized to the captain even though they coincide here.
|
||||
@@ -341,7 +365,10 @@ mod tests {
|
||||
m.insert(100000003, "oc-dup".to_string());
|
||||
m.insert(100000004, "oc-dup".to_string()); // collide onto same owned id
|
||||
let err = build_squad_write(&put, &MapResolver(m)).unwrap_err();
|
||||
assert_eq!(err, SquadBuildError::DuplicateOwnedItem("oc-dup".to_string()));
|
||||
assert_eq!(
|
||||
err,
|
||||
SquadBuildError::DuplicateOwnedItem("oc-dup".to_string())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -350,6 +377,10 @@ mod tests {
|
||||
assert_eq!(build.canonical.slots.len(), 11, "whole squad, not a diff");
|
||||
assert_eq!(build.canonical.formation.as_deref(), Some("f442"));
|
||||
// No FIFA wire integer survives into the canonical slots.
|
||||
assert!(build.canonical.slots.iter().all(|s| s.owned_card_id.starts_with("oc-")));
|
||||
assert!(build
|
||||
.canonical
|
||||
.slots
|
||||
.iter()
|
||||
.all(|s| s.owned_card_id.starts_with("oc-")));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user