From: Ian Jackson Date: Sun, 1 May 2022 17:21:55 +0000 (+0100) Subject: apitest: updatess: Expect to find the pieces we are updating X-Git-Tag: otter-1.1.0~358 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e2458410f38c641531672928094c922f15ce6813;p=otter.git apitest: updatess: Expect to find the pieces we are updating Signed-off-by: Ian Jackson --- diff --git a/apitest/atmain.rs b/apitest/atmain.rs index cdfe06b7..253c51a6 100644 --- a/apitest/atmain.rs +++ b/apitest/atmain.rs @@ -416,15 +416,14 @@ pub fn update_update_pieces( } fn findp<'p, PI:Idx>(pieces: &'p mut Pieces, piece: &'_ str) - -> Option<&'p mut PieceInfo> { - pieces.iter_mut().find(|p| p.id == piece) + -> &'p mut PieceInfo { + pieces.iter_mut().find(|p| p.id == piece).unwrap() } let v = v.as_object().unwrap(); if k == "Piece" { let p = findp(pieces, v["piece"].as_str().unwrap()); - if_let!{ Some(p) = p; else return } let (op, d) = v["op"].as_object().unwrap().iter().next().unwrap(); match op.as_str() {