From: Ian Jackson Date: Mon, 15 Feb 2021 00:03:21 +0000 (+0000) Subject: Use Void and abolish our Impossible X-Git-Tag: otter-0.4.0~452 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=0cd1a9359f1d30457ce64b5389e6f1c96d521896;p=otter.git Use Void and abolish our Impossible Signed-off-by: Ian Jackson --- diff --git a/daemon/api.rs b/daemon/api.rs index 98a3c6e1..413dc996 100644 --- a/daemon/api.rs +++ b/daemon/api.rs @@ -401,7 +401,7 @@ api_route!{ '_normal_global_ops__not_loop: loop { let pc = gs.pieces.byid_mut(piece)?; let gpl = gs.players.byid_mut(player)?; - let _: Impossible = match (self.opname.as_str(), self.wrc) { + let _: Void = match (self.opname.as_str(), self.wrc) { ("flip", wrc@ WRC::UpdateSvg) => { let nfaces = p.nfaces(); @@ -421,7 +421,7 @@ api_route!{ } '_abnormal_global_ops__notloop: loop { - let _: Impossible = match self { + let _: Void = match self { _ => break, }; diff --git a/src/global.rs b/src/global.rs index 373da0df..60faeba7 100644 --- a/src/global.rs +++ b/src/global.rs @@ -1397,8 +1397,8 @@ fn client_expire_old_clients() { #[derive(Debug)] struct Now(HashSet); impl ClientIterator for Now { - type Ret = Impossible; - fn old(&mut self, client: ClientId) -> Option { + type Ret = Void; + fn old(&mut self, client: ClientId) -> Option { self.0.insert(client); None } diff --git a/src/prelude.rs b/src/prelude.rs index dc9d269f..d20a432e 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -84,6 +84,7 @@ pub use strum::EnumString; pub use thiserror::Error; pub use url::Url; pub use vecdeque_stableix::Deque as StableIndexVecDeque; +pub use void::Void; pub use otter_base::zcoord::{self, ZCoord}; pub use otter_base::misc as base_misc; @@ -121,10 +122,6 @@ pub type SecondarySlotMap = slotmap::secondary::SecondaryMap; pub type SvgData = Vec; pub type Colour = Html; -#[derive(Debug,Copy,Clone)] -pub enum Impossible { } -display_as_debug!(Impossible); - // ---------- type abbreviations ---------- pub type AE = anyhow::Error; diff --git a/src/spec.rs b/src/spec.rs index 0e2d121a..1d6ee23e 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -376,7 +376,7 @@ pub mod implementation { pub fn account_glob(&self) -> String { fn scope_glob(scope: AccountScope) -> String { let mut out = "".to_string(); - scope.display_name(&["*"], |s| Ok::<_,Impossible>(out += s)).unwrap(); + scope.display_name(&["*"], |s| Ok::<_,Void>(out += s)).unwrap(); out } match self { diff --git a/src/tz.rs b/src/tz.rs index 002a94af..91d95d11 100644 --- a/src/tz.rs +++ b/src/tz.rs @@ -68,8 +68,8 @@ type MemoTable = Option>; static MEMO: RwLock = const_rwlock(None); impl FromStr for Timezone { - type Err = Impossible; - #[throws(Impossible)] + type Err = Void; + #[throws(Void)] fn from_str(name: &str) -> Self { if name.is_empty() { return default() }