From b6f57069b75febf1d312a98efcd6544c9db2fe59 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 4 May 2019 14:19:43 +0200 Subject: Remove dummy lifetimes --- dhall/src/traits/deserialize.rs | 10 +++++----- dhall/src/traits/dynamic_type.rs | 16 ++++++++-------- dhall/src/traits/static_type.rs | 40 ++++++++++++++++++++-------------------- 3 files changed, 33 insertions(+), 33 deletions(-) (limited to 'dhall/src/traits') diff --git a/dhall/src/traits/deserialize.rs b/dhall/src/traits/deserialize.rs index 99ca5ee..e3ff2d5 100644 --- a/dhall/src/traits/deserialize.rs +++ b/dhall/src/traits/deserialize.rs @@ -12,7 +12,7 @@ pub trait Deserialize<'de>: Sized { fn from_str(s: &'de str, ty: Option<&Type>) -> Result; } -impl<'de: 'a, 'a> Deserialize<'de> for Parsed<'a> { +impl<'de> Deserialize<'de> for Parsed { /// Simply parses the provided string. Ignores the /// provided type. fn from_str(s: &'de str, _: Option<&Type>) -> Result { @@ -20,7 +20,7 @@ impl<'de: 'a, 'a> Deserialize<'de> for Parsed<'a> { } } -impl<'de: 'a, 'a> Deserialize<'de> for Resolved<'a> { +impl<'de> Deserialize<'de> for Resolved { /// Parses and resolves the provided string. Ignores the /// provided type. fn from_str(s: &'de str, ty: Option<&Type>) -> Result { @@ -28,7 +28,7 @@ impl<'de: 'a, 'a> Deserialize<'de> for Resolved<'a> { } } -impl<'de: 'a, 'a> Deserialize<'de> for Typed<'a> { +impl<'de> Deserialize<'de> for Typed { /// Parses, resolves and typechecks the provided string. fn from_str(s: &'de str, ty: Option<&Type>) -> Result { let resolved = Resolved::from_str(s, ty)?; @@ -39,14 +39,14 @@ impl<'de: 'a, 'a> Deserialize<'de> for Typed<'a> { } } -impl<'de: 'a, 'a> Deserialize<'de> for Normalized<'a> { +impl<'de> Deserialize<'de> for Normalized { /// Parses, resolves, typechecks and normalizes the provided string. fn from_str(s: &'de str, ty: Option<&Type>) -> Result { Ok(Typed::from_str(s, ty)?.normalize()) } } -impl<'de: 'a, 'a> Deserialize<'de> for Type<'a> { +impl<'de> Deserialize<'de> for Type { fn from_str(s: &'de str, ty: Option<&Type>) -> Result { Ok(Normalized::from_str(s, ty)?.to_type()) } diff --git a/dhall/src/traits/dynamic_type.rs b/dhall/src/traits/dynamic_type.rs index b8f6f6d..858642e 100644 --- a/dhall/src/traits/dynamic_type.rs +++ b/dhall/src/traits/dynamic_type.rs @@ -7,29 +7,29 @@ use dhall_syntax::{Const, ExprF}; use std::borrow::Cow; pub trait DynamicType { - fn get_type<'a>(&'a self) -> Result>, TypeError>; + fn get_type<'a>(&'a self) -> Result, TypeError>; } impl DynamicType for T { - fn get_type<'a>(&'a self) -> Result>, TypeError> { + fn get_type<'a>(&'a self) -> Result, TypeError> { Ok(Cow::Owned(T::get_static_type())) } } -impl<'a> DynamicType for Type<'a> { - fn get_type(&self) -> Result>, TypeError> { +impl DynamicType for Type { + fn get_type(&self) -> Result, TypeError> { self.get_type() } } -impl<'a> DynamicType for Normalized<'a> { - fn get_type(&self) -> Result>, TypeError> { +impl DynamicType for Normalized { + fn get_type(&self) -> Result, TypeError> { self.0.get_type() } } -impl<'a> DynamicType for Typed<'a> { - fn get_type(&self) -> Result>, TypeError> { +impl DynamicType for Typed { + fn get_type(&self) -> Result, TypeError> { self.0.get_type() } } diff --git a/dhall/src/traits/static_type.rs b/dhall/src/traits/static_type.rs index 1255d1c..f90b8df 100644 --- a/dhall/src/traits/static_type.rs +++ b/dhall/src/traits/static_type.rs @@ -11,7 +11,7 @@ use dhall_syntax::*; /// For now the only interesting impl is [SimpleType] itself, who /// has a statically-known type which is not itself a [SimpleType]. pub trait StaticType { - fn get_static_type() -> Type<'static>; + fn get_static_type() -> Type; } /// A Rust type that can be represented as a Dhall type. @@ -29,15 +29,15 @@ pub trait StaticType { /// The `Simple` in `SimpleStaticType` indicates that the returned type is /// a [SimpleType]. pub trait SimpleStaticType { - fn get_simple_static_type<'a>() -> SimpleType<'a>; + fn get_simple_static_type() -> SimpleType; } -fn mktype<'a>(x: SubExpr) -> SimpleType<'a> { +fn mktype(x: SubExpr) -> SimpleType { x.into() } impl StaticType for T { - fn get_static_type() -> Type<'static> { + fn get_static_type() -> Type { crate::expr::Normalized::from_thunk_and_type( crate::normalize::Thunk::from_normalized_expr( T::get_simple_static_type().into(), @@ -48,64 +48,64 @@ impl StaticType for T { } } -impl<'a> StaticType for SimpleType<'a> { +impl StaticType for SimpleType { /// By definition, a [SimpleType] has type `Type`. /// This returns the Dhall expression `Type` - fn get_static_type() -> Type<'static> { + fn get_static_type() -> Type { Type::const_type() } } impl SimpleStaticType for bool { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { mktype(dhall::subexpr!(Bool)) } } impl SimpleStaticType for Natural { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { mktype(dhall::subexpr!(Natural)) } } impl SimpleStaticType for u32 { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { mktype(dhall::subexpr!(Natural)) } } impl SimpleStaticType for u64 { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { mktype(dhall::subexpr!(Natural)) } } impl SimpleStaticType for Integer { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { mktype(dhall::subexpr!(Integer)) } } impl SimpleStaticType for i32 { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { mktype(dhall::subexpr!(Integer)) } } impl SimpleStaticType for i64 { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { mktype(dhall::subexpr!(Integer)) } } impl SimpleStaticType for String { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { mktype(dhall::subexpr!(Text)) } } impl SimpleStaticType for (A, B) { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { let ta: SubExpr<_, _> = A::get_simple_static_type().into(); let tb: SubExpr<_, _> = B::get_simple_static_type().into(); mktype(dhall::subexpr!({ _1: ta, _2: tb })) @@ -113,27 +113,27 @@ impl SimpleStaticType for (A, B) { } impl SimpleStaticType for Option { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { let t: SubExpr<_, _> = T::get_simple_static_type().into(); mktype(dhall::subexpr!(Optional t)) } } impl SimpleStaticType for Vec { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { let t: SubExpr<_, _> = T::get_simple_static_type().into(); mktype(dhall::subexpr!(List t)) } } impl<'a, T: SimpleStaticType> SimpleStaticType for &'a T { - fn get_simple_static_type<'b>() -> SimpleType<'b> { + fn get_simple_static_type() -> SimpleType { T::get_simple_static_type() } } impl SimpleStaticType for std::marker::PhantomData { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { mktype(dhall::subexpr!({})) } } @@ -141,7 +141,7 @@ impl SimpleStaticType for std::marker::PhantomData { impl SimpleStaticType for std::result::Result { - fn get_simple_static_type<'a>() -> SimpleType<'a> { + fn get_simple_static_type() -> SimpleType { let tt: SubExpr<_, _> = T::get_simple_static_type().into(); let te: SubExpr<_, _> = E::get_simple_static_type().into(); mktype(dhall::subexpr!(< Ok: tt | Err: te>)) -- cgit v1.2.3