From b89b9884830c0324b669d7b5d522c08dc4797a06 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 13 Jul 2021 15:10:23 +0100 Subject: [PATCH] errors: Rename POE type alias to Ia Signed-off-by: Ian Jackson --- daemon/api.rs | 10 +++++----- src/error.rs | 4 ++-- src/global.rs | 8 ++++---- src/hidden.rs | 2 +- src/organise.rs | 6 +++--- src/prelude.rs | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/daemon/api.rs b/daemon/api.rs index 8e4a597d..30d144ae 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -125,7 +125,7 @@ fn api_piece_op(form: Json>) let was_held = gs.pieces.get(piece).as_ref().map(|gpc| gpc.held); match (||{ - let ipc = ipieces.get(piece).ok_or(POE::PieceGone)?; + let ipc = ipieces.get(piece).ok_or(Ia::PieceGone)?; let gpc = gs.pieces.byid_mut(piece)?; let q_gen = form.gen; @@ -321,7 +321,7 @@ api_route!{ let gpl = players.byid_mut(player)?; let pri = piece_pri(ioccults, &gs.occults, player, gpl, piece, gpc, ipc) - .ok_or(POE::PieceGone)?; + .ok_or(Ia::PieceGone)?; let pcs = pri.describe(ioccults,&gs.occults, gpc, ipc); @@ -400,7 +400,7 @@ api_route!{ ioccults,&gs.occults,gpl,gpc,ipc, "released" )?; - let who_by = who_by.ok_or(POE::PieceGone)?; + let who_by = who_by.ok_or(Ia::PieceGone)?; if gpc.held != Some(player) { throw!(Fatal::PieceHeld) } gpc.held = None; @@ -512,7 +512,7 @@ api_route!{ let ApiPieceOpArgs { gs,ioccults,player,piece,ipc, .. } = a; let gpc = gs.pieces.byid_mut(piece).unwrap(); if ! gpc.rotateable() || gpc.occult.is_active() { - throw!(POE::PieceUnrotateable) + throw!(Ia::PieceUnrotateable) } let gpl = gs.players.byid_mut(player).unwrap(); let logents = log_did_to_piece( @@ -567,7 +567,7 @@ api_route!{ player, gs.players.byid_mut(player)?, piece, gs.pieces.byid(piece)?, ipc) - .ok_or(POE::PieceGone)?; + .ok_or(Ia::PieceGone)?; let y = { use PriOG::*; match pri.occulted { diff --git a/src/error.rs b/src/error.rs index 22dfc84c..7b4c4cd7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -267,8 +267,8 @@ impl IdForById for T where T: AccessId { } impl IdForById for PieceId { - type Error = POE; - const ERROR: POE = POE::PieceGone; + type Error = Ia; + const ERROR: Ia = Ia::PieceGone; } #[macro_export] diff --git a/src/global.rs b/src/global.rs index 76e95dbc..f135d538 100644 --- a/src/global.rs +++ b/src/global.rs @@ -1417,13 +1417,13 @@ impl ById for GPieces { type Id = PieceId; type Entry = GPiece; type Error = Inapplicable; - #[throws(POE)] + #[throws(Ia)] fn byid(&self, piece: PieceId) -> &GPiece { - self.get(piece).ok_or(POE::PieceGone)? + self.get(piece).ok_or(Ia::PieceGone)? } - #[throws(POE)] + #[throws(Ia)] fn byid_mut(&mut self, piece: PieceId) -> &mut GPiece { - self.get_mut(piece).ok_or(POE::PieceGone)? + self.get_mut(piece).ok_or(Ia::PieceGone)? } } diff --git a/src/hidden.rs b/src/hidden.rs index 3228fda0..f768fb0f 100644 --- a/src/hidden.rs +++ b/src/hidden.rs @@ -429,7 +429,7 @@ impl GPiece { pub fn occulter_check_unrotated(&self, _:ShowUnocculted) -> Result { - if self.angle.is_rotated() { Err(POE::OcculterAlreadyRotated) } + if self.angle.is_rotated() { Err(Ia::OcculterAlreadyRotated) } else { Ok(OcculterRotationChecked(())) } } diff --git a/src/organise.rs b/src/organise.rs index 30619340..d9b4f941 100644 --- a/src/organise.rs +++ b/src/organise.rs @@ -128,7 +128,7 @@ fn recover_order(region: &Rect, pieces: &Primary, zlevels: &ZLevels) // This algorithm is quadratic. 320^2 = 102K let len = pieces.len(); - if len > 320 { throw!(POE::OrganisedPlacementOverfull) } + if len > 320 { throw!(Ia::OrganisedPlacementOverfull) } let mut remain: Vec = (0..len).map(Into::into).collect(); let mut out = index_vec![]; @@ -290,11 +290,11 @@ pub fn ui_operation(a: &mut ApiPieceOpArgs<'_>, _: OcculterRotationChecked, for &pos in &layout { // Some sanity checks pos.clamped(gs.table_size).map_err( - |_| APOE::Inapplicable(POE::PosOffTable))?; + |_| APOE::Inapplicable(Ia::PosOffTable))?; match gs.occults.pos_occulter(&gs.occults, pos)? { None => {}, Some(occulter) if occulter == apiece => {}, - Some(_) => throw!(APOE::Inapplicable(POE::Occultation)), + Some(_) => throw!(APOE::Inapplicable(Ia::Occultation)), }; } diff --git a/src/prelude.rs b/src/prelude.rs index afc9aada..83b6d9a1 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -197,7 +197,7 @@ pub type APOE = ApiPieceOpError; pub type ESVU = ErrorSignaledViaUpdate; pub type IE = InternalError; pub type OE = Fatal; // xxx get rid of this alyas when we've cleaned up Fatal -pub type POE = Inapplicable; // xxx rename this alias +pub type Ia = Inapplicable; pub type POEPP = PieceOpErrorPartiallyProcessed; pub type SvgE = SVGProcessingError; pub type SpE = SpecError; -- 2.30.2