summaryrefslogtreecommitdiff
path: root/dhall/src/phase/binary.rs
diff options
context:
space:
mode:
authorFintan Halpenny2019-09-02 21:17:00 +0100
committerFintan Halpenny2019-09-02 21:17:00 +0100
commite73f822b6972e8fa2e72b56ff5378b91bea1a5e6 (patch)
tree853d36295b3a705d9143e0feb72855f900237de0 /dhall/src/phase/binary.rs
parent4a86274878d5ab0ef4f9d8597606226adfd048de (diff)
Remove the notion of Directory and have File be the vector of components
Diffstat (limited to 'dhall/src/phase/binary.rs')
-rw-r--r--dhall/src/phase/binary.rs18
1 files changed, 5 insertions, 13 deletions
diff --git a/dhall/src/phase/binary.rs b/dhall/src/phase/binary.rs
index 6bdc3f9..89b6db2 100644
--- a/dhall/src/phase/binary.rs
+++ b/dhall/src/phase/binary.rs
@@ -7,7 +7,7 @@ use dhall_syntax::map::DupTreeMap;
use dhall_syntax::{
rc, ExprF, FilePrefix, Hash, Import, ImportHashed, ImportLocation,
ImportMode, Integer, InterpolatedText, Label, Natural, Scheme, SubExpr,
- URL, V, Directory, File,
+ URL, V, File,
};
use crate::error::{DecodeError, EncodeError};
@@ -291,7 +291,7 @@ fn cbor_value_to_dhall(
"import/remote/query".to_owned(),
))?,
};
- let mut components: Vec<_> = rest
+ let file_path: Vec<_> = rest
.map(|s| match s.as_string() {
Some(s) => Ok(s.clone()),
None => Err(DecodeError::WrongFormatError(
@@ -299,11 +299,7 @@ fn cbor_value_to_dhall(
)),
})
.collect::<Result<_, _>>()?;
- let file = components.pop().ok_or(
- DecodeError::WrongFormatError(
- "import/remote/path".to_owned(),
- ))?;
- let path = File { directory: Directory { components: components }, file: file };
+ let path = File { file_path };
ImportLocation::Remote(URL {
scheme,
authority,
@@ -322,7 +318,7 @@ fn cbor_value_to_dhall(
"import/local/prefix".to_owned(),
))?,
};
- let mut components: Vec<_> = rest
+ let file_path: Vec<_> = rest
.map(|s| match s.as_string() {
Some(s) => Ok(s.clone()),
None => Err(DecodeError::WrongFormatError(
@@ -330,11 +326,7 @@ fn cbor_value_to_dhall(
)),
})
.collect::<Result<_, _>>()?;
- let file = components.pop().ok_or(
- DecodeError::WrongFormatError(
- "import/remote/path".to_owned(),
- ))?;
- let path = File { directory: Directory { components: components }, file: file };
+ let path = File { file_path };
ImportLocation::Local(prefix, path)
}
6 => {