From: Ian Jackson Date: Tue, 23 Mar 2021 22:53:01 +0000 (+0000) Subject: hand: Move owned to where we can reuse it X-Git-Tag: otter-0.5.0~489 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=29668ab8ef19edc14893967479655d57fb4314ea;p=otter.git hand: Move owned to where we can reuse it Signed-off-by: Ian Jackson --- diff --git a/src/hand.rs b/src/hand.rs index 07d5e8bf..0808a505 100644 --- a/src/hand.rs +++ b/src/hand.rs @@ -88,12 +88,15 @@ impl PieceTrait for Hand { fn nfaces(&self) -> RawFaceId { 1 } #[throws(IE)] fn svg_piece(&self, f: &mut Html, gpc: &GPiece, _gs: &GameState, _vpid: VisiblePieceId) { + let owned = if_chain!{ + if let Some(xdata) = gpc.xdata.get::()?; + if let Some(owned) = &xdata.owner; + then { Some(owned) } + else { None } + }; self.shape.svg_piece_raw(f, gpc.face, &mut |f: &mut String| { - if_chain!{ - if let Some(xdata) = gpc.xdata.get::()?; - if let Some(owned) = &xdata.owner; - then { write!(f, r##" stroke-dasharray="{}" "##, - &owned.dasharray.0)?; } + if let Some(owned) = owned { + write!(f, r##" stroke-dasharray="{}" "##, &owned.dasharray.0)?; } Ok(()) })?;