summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
Diffstat (limited to 'dhall')
-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
3 files changed, 9 insertions, 9 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 }