From: Ian Jackson Date: Mon, 18 Apr 2022 12:01:34 +0000 (+0100) Subject: api: Replace open-coded calculation with call to fully_visible X-Git-Tag: otter-1.1.0~488 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=6d09d735ee34032e4dbad35d290719ab6558e245;p=otter.git api: Replace open-coded calculation with call to fully_visible Signed-off-by: Ian Jackson --- diff --git a/daemon/api.rs b/daemon/api.rs index 94092cb3..c5e0850f 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -582,13 +582,7 @@ api_route!{ piece, gs.pieces.byid(piece)?, ipc) .ok_or(Ia::PieceGone)?; - let y = { - use PriOG::*; - match pri.occulted { - Visible(y) => y, - Occulted | Displaced(..) => throw!(Ia::Occultation), - } - }; + let y = pri.fully_visible().ok_or(Ia::Occultation)?; '_normal_global_ops__not_loop: loop { let gpc = gs.pieces.byid_mut(piece)?;