From: Ian Jackson Date: Mon, 11 Apr 2022 09:45:39 +0000 (+0100) Subject: Style: tidy up and use fehler X-Git-Tag: otter-1.1.0~617 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=8068253c1b16c9601836aeb72bee7ed954075a47;p=otter.git Style: tidy up and use fehler Empirically, without the let r = ...; r, fehler and if_chain! produce a type error. That must be why we had the fehler use commented out. But this way it works. Signed-off-by: Ian Jackson --- diff --git a/src/pieces.rs b/src/pieces.rs index c213e1a3..a1563be1 100644 --- a/src/pieces.rs +++ b/src/pieces.rs @@ -133,19 +133,15 @@ impl PieceTrait for SimpleShape { _gs: &GameState, _vpid: VisiblePieceId) { self.svg_piece_raw(f, gpc.face, &mut |_|Ok(()))?; } -// #[throws(IE)] - fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults) -// -> Html --> Result - { -Ok::<_,IE>( - if_chain! { + #[throws(IE)] + fn describe_html(&self, gpc: &GPiece, _goccults: &GameOccults) -> Html { + let r = if_chain! { if let face = gpc.face; if let Some(colour) = self.colours.get(face); then { hformat!("a {} {}", colour, self.desc) } else { hformat!("a {}", self.desc) } - } -) + }; + r } fn nfaces(&self) -> RawFaceId { self.count_faces().try_into().unwrap()