chiark / gitweb /
hidden: style: Use if_let macro a couple more times
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 17 Apr 2022 17:51:47 +0000 (18:51 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 17 Apr 2022 18:00:24 +0000 (19:00 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/vpid.rs

index 5ff139d4d342ec96b29bc51a78f4fb91d2dc296d..bb5f3d1975a4bcd71ac37f759b9df2488f60de09 100644 (file)
@@ -294,14 +294,14 @@ pub fn permute(occid: OccId,
 
     for (notch, nr) in occ.notches.table.iter_enumerated() {
       let piece = if let Some(p) = nr.piece() { p } else { continue };
-      let gpc = if let Some(gpc) = gpieces.get(piece) { gpc }else{ continue };
+      if_let!{ Some(gpc) = gpieces.get(piece); else continue }
       if gpc.held.is_some() { continue }
       let occilk = (|| Some(ipieces.get(piece)?.occilk.as_ref()?))();
-      let occilk = if let Some(o) = occilk { *o.borrow() } else {
+      if_let!{ Some(occilk) = occilk; else {
         error!("{}", internal_error_bydebug(&(occid, &occ, &nr, piece)));
         continue;
-      };
-      let (notches, pieces) = ilks.entry(occilk).or_default();
+      }}
+      let (notches, pieces) = ilks.entry(*occilk.borrow()).or_default();
       notches.push(notch);
       pieces.push(piece);
     }