From 6c1d3807560dd2d177096118f8cce03933511685 Mon Sep 17 00:00:00 2001 From: Jascha Date: Fri, 23 Jun 2017 14:12:47 +0200 Subject: Make boxed errors Send + Sync --- src/error.rs | 4 ++-- src/file/format/json.rs | 2 +- src/file/format/mod.rs | 2 +- src/file/format/toml.rs | 2 +- src/file/format/yaml.rs | 2 +- src/file/source/file.rs | 4 ++-- src/file/source/mod.rs | 2 +- src/file/source/string.rs | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/error.rs b/src/error.rs index 6b567a2..514a5e2 100644 --- a/src/error.rs +++ b/src/error.rs @@ -50,7 +50,7 @@ pub enum ConfigError { /// The captured error from attempting to parse the file in its desired format. /// This is the actual error object from the library used for the parsing. - cause: Box + cause: Box }, /// Value could not be converted into the requested type. @@ -75,7 +75,7 @@ pub enum ConfigError { Message(String), /// Unadorned error from a foreign origin. - Foreign(Box), + Foreign(Box), } impl ConfigError { diff --git a/src/file/format/json.rs b/src/file/format/json.rs index ed6c787..ead99f8 100644 --- a/src/file/format/json.rs +++ b/src/file/format/json.rs @@ -4,7 +4,7 @@ use std::collections::HashMap; use std::error::Error; use value::{Value, ValueKind}; -pub fn parse(uri: Option<&String>, text: &str) -> Result, Box> { +pub fn parse(uri: Option<&String>, text: &str) -> Result, Box> { // Parse a JSON object value from the text // TODO: Have a proper error fire if the root of a file is ever not a Table let value = from_json_value(uri, &serde_json::from_str(text)?); diff --git a/src/file/format/mod.rs b/src/file/format/mod.rs index b3cf279..5aa1acb 100644 --- a/src/file/format/mod.rs +++ b/src/file/format/mod.rs @@ -66,7 +66,7 @@ impl FileFormat { pub fn parse(&self, uri: Option<&String>, text: &str) - -> Result, Box> { + -> Result, Box> { match *self { #[cfg(feature = "toml")] FileFormat::Toml => toml::parse(uri, text), diff --git a/src/file/format/toml.rs b/src/file/format/toml.rs index cecad75..4307e48 100644 --- a/src/file/format/toml.rs +++ b/src/file/format/toml.rs @@ -4,7 +4,7 @@ use std::collections::{HashMap, BTreeMap}; use std::error::Error; use value::{Value, ValueKind}; -pub fn parse(uri: Option<&String>, text: &str) -> Result, Box> { +pub fn parse(uri: Option<&String>, text: &str) -> Result, Box> { // Parse a TOML value from the provided text // TODO: Have a proper error fire if the root of a file is ever not a Table let value = from_toml_value(uri, &toml::from_str(text)?); diff --git a/src/file/format/yaml.rs b/src/file/format/yaml.rs index 4040ea6..3ed1356 100644 --- a/src/file/format/yaml.rs +++ b/src/file/format/yaml.rs @@ -6,7 +6,7 @@ use std::collections::{BTreeMap, HashMap}; use std::mem; use value::{Value, ValueKind}; -pub fn parse(uri: Option<&String>, text: &str) -> Result, Box> { +pub fn parse(uri: Option<&String>, text: &str) -> Result, Box> { // Parse a YAML object from file let mut docs = yaml::YamlLoader::load_from_str(text)?; let root = match docs.len() { diff --git a/src/file/source/file.rs b/src/file/source/file.rs index 790933f..7bf29be 100644 --- a/src/file/source/file.rs +++ b/src/file/source/file.rs @@ -26,7 +26,7 @@ impl FileSourceFile { fn find_file(&self, format_hint: Option) - -> Result<(PathBuf, FileFormat), Box> { + -> Result<(PathBuf, FileFormat), Box> { // First check for an _exact_ match let mut filename = env::current_dir()?.as_path().join(self.name.clone()); if filename.is_file() { @@ -83,7 +83,7 @@ impl FileSourceFile { impl FileSource for FileSourceFile { fn resolve(&self, format_hint: Option) - -> Result<(Option, String, FileFormat), Box> { + -> Result<(Option, String, FileFormat), Box> { // Find file let (filename, format) = self.find_file(format_hint)?; diff --git a/src/file/source/mod.rs b/src/file/source/mod.rs index 67e2cf1..f164d27 100644 --- a/src/file/source/mod.rs +++ b/src/file/source/mod.rs @@ -11,5 +11,5 @@ use super::FileFormat; pub trait FileSource: Debug + Clone { fn resolve(&self, format_hint: Option) - -> Result<(Option, String, FileFormat), Box>; + -> Result<(Option, String, FileFormat), Box>; } diff --git a/src/file/source/string.rs b/src/file/source/string.rs index 70101d6..5dbd1b9 100644 --- a/src/file/source/string.rs +++ b/src/file/source/string.rs @@ -18,7 +18,7 @@ impl<'a> From<&'a str> for FileSourceString { impl FileSource for FileSourceString { fn resolve(&self, format_hint: Option) - -> Result<(Option, String, FileFormat), Box> { + -> Result<(Option, String, FileFormat), Box> { Ok((None, self.0.clone(), format_hint.expect("from_str requires a set file format"))) } } -- cgit v1.2.3