From 509743469035582d916e6a2f331fd5018c81447e Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 16 Aug 2019 11:11:28 +0200 Subject: Use `!` type instead of custom empty type --- dhall_syntax/src/core/expr.rs | 14 ++------------ dhall_syntax/src/core/visitor.rs | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) (limited to 'dhall_syntax/src/core') diff --git a/dhall_syntax/src/core/expr.rs b/dhall_syntax/src/core/expr.rs index 30ac4eb..efbcee2 100644 --- a/dhall_syntax/src/core/expr.rs +++ b/dhall_syntax/src/core/expr.rs @@ -8,20 +8,10 @@ pub type Integer = isize; pub type Natural = usize; pub type Double = NaiveDouble; -/// An empty type -#[derive(Debug, Copy, Clone, PartialEq, Eq)] -pub enum Void {} - -impl std::fmt::Display for Void { - fn fmt(&self, _f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { - match *self {} - } -} - -pub fn trivial_result(x: Result) -> T { +pub fn trivial_result(x: Result) -> T { match x { Ok(x) => x, - Err(e) => match e {}, + Err(e) => e, } } diff --git a/dhall_syntax/src/core/visitor.rs b/dhall_syntax/src/core/visitor.rs index 7b4ed4b..5a5fcc9 100644 --- a/dhall_syntax/src/core/visitor.rs +++ b/dhall_syntax/src/core/visitor.rs @@ -176,7 +176,7 @@ impl<'a, T, SE1, SE2, E1, E2> ExprFFallibleVisitor<'a, SE1, SE2, E1, E2> where T: ExprFInFallibleVisitor<'a, SE1, SE2, E1, E2>, { - type Error = Void; + type Error = !; fn visit_subexpr(&mut self, subexpr: &'a SE1) -> Result { Ok(self.0.visit_subexpr(subexpr)) -- cgit v1.2.3