chiark / gitweb /
Style: tidy up and use fehler
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 11 Apr 2022 09:45:39 +0000 (10:45 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 11 Apr 2022 09:45:39 +0000 (10:45 +0100)
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 <ijackson@chiark.greenend.org.uk>
src/pieces.rs

index c213e1a36122d54e985b8a765670b836e7c226da..a1563be1944607550694d7f3c0a5ef605e346ad5 100644 (file)
@@ -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<Html, IE>
-  {
-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()