summaryrefslogtreecommitdiffstats
path: root/src/file
diff options
context:
space:
mode:
Diffstat (limited to 'src/file')
-rw-r--r--src/file/mod.rs15
-rw-r--r--src/file/yaml.rs4
2 files changed, 15 insertions, 4 deletions
diff --git a/src/file/mod.rs b/src/file/mod.rs
index 519a4bf..6c72c37 100644
--- a/src/file/mod.rs
+++ b/src/file/mod.rs
@@ -62,13 +62,19 @@ impl FileFormat {
}
pub trait FileSource {
- fn try_build(&self, format: FileFormat, namespace: Option<&String>) -> Result<Box<Source>, Box<Error>>;
+ fn try_build(&self,
+ format: FileFormat,
+ namespace: Option<&String>)
+ -> Result<Box<Source>, Box<Error>>;
}
pub struct FileSourceString(String);
impl FileSource for FileSourceString {
- fn try_build(&self, format: FileFormat, namespace: Option<&String>) -> Result<Box<Source>, Box<Error>> {
+ fn try_build(&self,
+ format: FileFormat,
+ namespace: Option<&String>)
+ -> Result<Box<Source>, Box<Error>> {
format.parse(&self.0, namespace)
}
}
@@ -123,7 +129,10 @@ impl FileSourceFile {
}
impl FileSource for FileSourceFile {
- fn try_build(&self, format: FileFormat, namespace: Option<&String>) -> Result<Box<Source>, Box<Error>> {
+ fn try_build(&self,
+ format: FileFormat,
+ namespace: Option<&String>)
+ -> Result<Box<Source>, Box<Error>> {
// Find file
let filename = self.find_file(format)?;
diff --git a/src/file/yaml.rs b/src/file/yaml.rs
index 00b749c..7a70a4e 100644
--- a/src/file/yaml.rs
+++ b/src/file/yaml.rs
@@ -20,7 +20,9 @@ impl Content {
let mut root = match docs.len() {
0 => yaml::Yaml::Hash(BTreeMap::new()),
1 => mem::replace(&mut docs[0], yaml::Yaml::Null),
- n => { return Err(Box::new(MultipleDocumentsError(n))); }
+ n => {
+ return Err(Box::new(MultipleDocumentsError(n)));
+ }
};
// Limit to namespace