summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dhall/src/operations/normalization.rs4
-rw-r--r--dhall/src/operations/typecheck.rs6
-rw-r--r--dhall/src/syntax/ast/label.rs6
3 files changed, 11 insertions, 5 deletions
diff --git a/dhall/src/operations/normalization.rs b/dhall/src/operations/normalization.rs
index e3a9415..86fed13 100644
--- a/dhall/src/operations/normalization.rs
+++ b/dhall/src/operations/normalization.rs
@@ -226,11 +226,11 @@ pub fn normalize_operation(opkind: &OpKind<Nir>) -> Ret {
Some(h) => ret_kind(h.app_to_kind(v.clone())),
None => nothing_to_do(),
},
- EmptyOptionalLit(_) => match kvs.get(&"None".into()) {
+ EmptyOptionalLit(_) => match kvs.get("None") {
Some(h) => ret_ref(h),
None => nothing_to_do(),
},
- NEOptionalLit(v) => match kvs.get(&"Some".into()) {
+ NEOptionalLit(v) => match kvs.get("Some") {
Some(h) => ret_kind(h.app_to_kind(v.clone())),
None => nothing_to_do(),
},
diff --git a/dhall/src/operations/typecheck.rs b/dhall/src/operations/typecheck.rs
index 91d5059..314c587 100644
--- a/dhall/src/operations/typecheck.rs
+++ b/dhall/src/operations/typecheck.rs
@@ -398,11 +398,11 @@ pub fn typecheck_operation(
if kts.len() != 2 {
return span_err(err_msg);
}
- match kts.get(&"mapKey".into()) {
+ match kts.get("mapKey") {
Some(t) if *t == Nir::from_builtin(Builtin::Text) => {}
_ => return span_err(err_msg),
}
- match kts.get(&"mapValue".into()) {
+ match kts.get("mapValue") {
Some(_) => {}
None => return span_err(err_msg),
}
@@ -434,7 +434,7 @@ pub fn typecheck_operation(
}
Field(scrut, x) => {
match scrut.ty().kind() {
- RecordType(kts) => match kts.get(&x) {
+ RecordType(kts) => match kts.get(x) {
Some(val) => Type::new_infer_universe(env, val.clone())?,
None => return span_err("MissingRecordField"),
},
diff --git a/dhall/src/syntax/ast/label.rs b/dhall/src/syntax/ast/label.rs
index 43c3f53..2abde80 100644
--- a/dhall/src/syntax/ast/label.rs
+++ b/dhall/src/syntax/ast/label.rs
@@ -24,6 +24,12 @@ impl From<&Label> for String {
}
}
+impl std::borrow::Borrow<str> for Label {
+ fn borrow(&self) -> &str {
+ self.0.as_ref()
+ }
+}
+
impl Label {
pub fn from_str(s: &str) -> Label {
Label(s.into())