From: Ian Jackson Date: Sun, 17 Apr 2022 17:51:47 +0000 (+0100) Subject: hidden: style: Use if_let macro a couple more times X-Git-Tag: otter-1.1.0~507 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=bc321c4078b4c0adf079fb91b72fcc020284aa46;p=otter.git hidden: style: Use if_let macro a couple more times Signed-off-by: Ian Jackson --- diff --git a/src/vpid.rs b/src/vpid.rs index 5ff139d4..bb5f3d19 100644 --- a/src/vpid.rs +++ b/src/vpid.rs @@ -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); }