chiark / gitweb /
Use Void and abolish our Impossible
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 15 Feb 2021 00:03:21 +0000 (00:03 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 15 Feb 2021 00:03:21 +0000 (00:03 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
daemon/api.rs
src/global.rs
src/prelude.rs
src/spec.rs
src/tz.rs

index 98a3c6e1ab04a2c493d4e3ad08b50030adb3c9f3..413dc9965e19414a7b5769a67b298192185b1b31 100644 (file)
@@ -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,
       };
index 373da0dfe9ff1029f7dde2f5b5624f25683aebb6..60faeba7b96b5db4972ee5d49db6e094e40c436e 100644 (file)
@@ -1397,8 +1397,8 @@ fn client_expire_old_clients() {
     #[derive(Debug)]
     struct Now(HashSet<ClientId>);
     impl ClientIterator for Now {
-      type Ret = Impossible;
-      fn old(&mut self, client: ClientId) -> Option<Impossible> {
+      type Ret = Void;
+      fn old(&mut self, client: ClientId) -> Option<Void> {
         self.0.insert(client);
         None
       }
index dc9d269fa3b6e34775e3b575c66a32952d5c900d..d20a432eaa198197d598ecbceb06f71d995bb31a 100644 (file)
@@ -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<K,V> = slotmap::secondary::SecondaryMap<K,V>;
 pub type SvgData = Vec<u8>;
 pub type Colour = Html;
 
-#[derive(Debug,Copy,Clone)]
-pub enum Impossible { }
-display_as_debug!(Impossible);
-
 // ---------- type abbreviations ----------
 
 pub type AE = anyhow::Error;
index 0e2d121ab93dd78c00a86efdf18a2dde29f81ed8..1d6ee23eebf1f4951f5595f8858c9f5f30cc8f50 100644 (file)
@@ -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 {
index 002a94af679396cb7a4bdb7d842432570380ed89..91d95d113009329a2387c55a4209325447ca6e67 100644 (file)
--- a/src/tz.rs
+++ b/src/tz.rs
@@ -68,8 +68,8 @@ type MemoTable = Option<HashMap<String, Timezone>>;
 static MEMO: RwLock<MemoTable> = 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() }