From: Ian Jackson Date: Fri, 29 Jan 2021 18:21:37 +0000 (+0000) Subject: wdt: Use w.piece_held() X-Git-Tag: otter-0.4.0~646 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=133feed60d940db96c8cf8f495cdc37a059f7a70;p=otter.git wdt: Use w.piece_held() Rather than the clone-and-hack copy. Tidying up, NFC. Signed-off-by: Ian Jackson --- diff --git a/wdriver/wdt-simple.rs b/wdriver/wdt-simple.rs index e71423f6..834a369f 100644 --- a/wdriver/wdt-simple.rs +++ b/wdriver/wdt-simple.rs @@ -235,7 +235,7 @@ impl Ctx { struct Got { now: Pos, log: Vec, - held: serde_json::Value, + held: Option, } let gots = sides.iter().map(|side|{ @@ -255,11 +255,7 @@ impl Ctx { .collect::,_>>()?; // xxx clone and hack - let held = w.execute_script(&format!(r##" - let pc = pieces['{}']; - return pc.held; - "##, &pc))?; - let held = held.value().to_owned(); + let held = w.piece_held(&pc)?; Ok::<_,AE>(Got { now, log, held }) }).collect::,AE>>()?;