summaryrefslogtreecommitdiffstats
path: root/src/file/mod.rs
diff options
context:
space:
mode:
authorRyan Leckey <leckey.ryan@gmail.com>2017-07-30 13:20:36 -0700
committerRyan Leckey <leckey.ryan@gmail.com>2017-07-30 13:20:36 -0700
commit14224be23dc2f253a240b85214927d97e1160669 (patch)
tree6f5b02b26aef5cf37bb14f32b9048165b67109ce /src/file/mod.rs
parent71f4b182d1e56febda64bd620ae0e0f65de333cd (diff)
Remove ConfigResult; close #36
Diffstat (limited to 'src/file/mod.rs')
-rw-r--r--src/file/mod.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/file/mod.rs b/src/file/mod.rs
index 45deb92..6586ede 100644
--- a/src/file/mod.rs
+++ b/src/file/mod.rs
@@ -12,7 +12,8 @@ pub use self::format::FileFormat;
#[derive(Clone, Debug)]
pub struct File<T>
- where T: FileSource
+where
+ T: FileSource,
{
source: T,
@@ -86,8 +87,9 @@ impl<T: FileSource> File<T> {
}
impl<T: FileSource> Source for File<T>
- where T: 'static,
- T: Sync + Send
+where
+ T: 'static,
+ T: Sync + Send,
{
fn clone_into_box(&self) -> Box<Source + Send + Sync> {
Box::new((*self).clone())
@@ -96,8 +98,9 @@ impl<T: FileSource> Source for File<T>
fn collect(&self) -> Result<HashMap<String, Value>> {
// Coerce the file contents to a string
let (uri, contents, format) = match self.source
- .resolve(self.format)
- .map_err(|err| ConfigError::Foreign(err)) {
+ .resolve(self.format)
+ .map_err(|err| ConfigError::Foreign(err))
+ {
Ok((uri, contents, format)) => (uri, contents, format),
Err(error) => {
@@ -111,10 +114,10 @@ impl<T: FileSource> Source for File<T>
// Parse the string using the given format
format.parse(uri.as_ref(), &contents).map_err(|cause| {
- ConfigError::FileParse {
- uri: uri,
- cause: cause,
- }
- })
+ ConfigError::FileParse {
+ uri: uri,
+ cause: cause,
+ }
+ })
}
}