summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dhall/src/lib.rs3
-rw-r--r--dhall/src/semantics/resolve/env.rs11
-rw-r--r--dhall/src/semantics/tck/env.rs4
-rw-r--r--serde_dhall/src/static_type.rs6
-rw-r--r--serde_dhall/src/value.rs4
5 files changed, 13 insertions, 15 deletions
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs
index adca2de..392c344 100644
--- a/dhall/src/lib.rs
+++ b/dhall/src/lib.rs
@@ -1,7 +1,10 @@
#![doc(html_root_url = "https://docs.rs/dhall/0.4.0")]
#![allow(
+ clippy::implicit_hasher,
clippy::module_inception,
clippy::needless_lifetimes,
+ clippy::new_ret_no_self,
+ clippy::new_without_default,
clippy::useless_format
)]
diff --git a/dhall/src/semantics/resolve/env.rs b/dhall/src/semantics/resolve/env.rs
index d5bb15b..d7ff0ae 100644
--- a/dhall/src/semantics/resolve/env.rs
+++ b/dhall/src/semantics/resolve/env.rs
@@ -5,7 +5,7 @@ use crate::semantics::{AlphaVar, ImportLocation, TypedHir, VarEnv};
use crate::syntax::{Label, V};
/// Environment for resolving names.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, Default)]
pub struct NameEnv {
names: Vec<Label>,
}
@@ -14,7 +14,7 @@ pub type ImportCache = HashMap<ImportLocation, TypedHir>;
pub type ImportStack = Vec<ImportLocation>;
/// Environment for resolving imports
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, Default)]
pub struct ImportEnv {
cache: ImportCache,
stack: ImportStack,
@@ -22,7 +22,7 @@ pub struct ImportEnv {
impl NameEnv {
pub fn new() -> Self {
- NameEnv { names: Vec::new() }
+ NameEnv::default()
}
pub fn as_varenv(&self) -> VarEnv {
VarEnv::from_size(self.names.len())
@@ -66,10 +66,7 @@ impl NameEnv {
impl ImportEnv {
pub fn new() -> Self {
- ImportEnv {
- cache: HashMap::new(),
- stack: Vec::new(),
- }
+ ImportEnv::default()
}
pub fn handle_import(
diff --git a/dhall/src/semantics/tck/env.rs b/dhall/src/semantics/tck/env.rs
index f2ef00a..1fa66f0 100644
--- a/dhall/src/semantics/tck/env.rs
+++ b/dhall/src/semantics/tck/env.rs
@@ -2,7 +2,7 @@ use crate::semantics::{AlphaVar, NameEnv, Nir, NzEnv, NzVar, Type, ValEnv};
use crate::syntax::Label;
/// Environment for indexing variables.
-#[derive(Debug, Clone, Copy)]
+#[derive(Debug, Clone, Copy, Default)]
pub struct VarEnv {
size: usize,
}
@@ -16,7 +16,7 @@ pub struct TyEnv {
impl VarEnv {
pub fn new() -> Self {
- VarEnv { size: 0 }
+ VarEnv::default()
}
pub fn from_size(size: usize) -> Self {
VarEnv { size }
diff --git a/serde_dhall/src/static_type.rs b/serde_dhall/src/static_type.rs
index f7b72b5..26c70cd 100644
--- a/serde_dhall/src/static_type.rs
+++ b/serde_dhall/src/static_type.rs
@@ -117,7 +117,6 @@ where
.into_iter()
.collect(),
)
- .into()
}
}
@@ -135,7 +134,6 @@ where
.into_iter()
.collect(),
)
- .into()
}
}
@@ -144,7 +142,7 @@ where
T: StaticType,
{
fn static_type() -> SimpleType {
- SimpleType::Optional(Box::new(T::static_type())).into()
+ SimpleType::Optional(Box::new(T::static_type()))
}
}
@@ -153,7 +151,7 @@ where
T: StaticType,
{
fn static_type() -> SimpleType {
- SimpleType::List(Box::new(T::static_type())).into()
+ SimpleType::List(Box::new(T::static_type()))
}
}
diff --git a/serde_dhall/src/value.rs b/serde_dhall/src/value.rs
index 7baeee9..d6631da 100644
--- a/serde_dhall/src/value.rs
+++ b/serde_dhall/src/value.rs
@@ -226,12 +226,12 @@ impl SimpleType {
ExprKind::App(hir(ExprKind::Builtin(Builtin::List)), t.to_hir())
}
SimpleType::Record(kts) => ExprKind::RecordType(
- kts.into_iter()
+ kts.iter()
.map(|(k, t)| (k.as_str().into(), t.to_hir()))
.collect(),
),
SimpleType::Union(kts) => ExprKind::UnionType(
- kts.into_iter()
+ kts.iter()
.map(|(k, t)| {
(k.as_str().into(), t.as_ref().map(|t| t.to_hir()))
})