From ddc41bf5d295402499fffa2f78b75583310b5c0c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 26 Jun 2021 15:29:26 +0200 Subject: Refactor: Import Result and use it instead of specifying full type path Signed-off-by: Matthias Beyer --- src/builder.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/builder.rs b/src/builder.rs index 627ba2a..a64040a 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -1,7 +1,8 @@ use std::str::FromStr; use std::{collections::HashMap, iter::IntoIterator}; -use crate::{config::Config, error, path::Expression, source::Source, value::Value}; +use crate::error::Result; +use crate::{config::Config, path::Expression, source::Source, value::Value}; /// A configuration builder /// @@ -72,7 +73,7 @@ impl ConfigBuilder { /// # Errors /// /// Fails if `Expression::from_str(key)` fails. - pub fn set_default(mut self, key: S, value: T) -> error::Result + pub fn set_default(mut self, key: S, value: T) -> Result where S: AsRef, T: Into, @@ -100,7 +101,7 @@ impl ConfigBuilder { /// # Errors /// /// Fails if `Expression::from_str(key)` fails. - pub fn set_override(mut self, key: S, value: T) -> error::Result + pub fn set_override(mut self, key: S, value: T) -> Result where S: AsRef, T: Into, @@ -118,7 +119,7 @@ impl ConfigBuilder { /// # Errors /// If source collection fails, be it technical reasons or related to inability to read data as `Config` for different reasons, /// this method returns error. - pub fn build(self) -> error::Result { + pub fn build(self) -> Result { Self::build_internal(self.defaults, self.overrides, &self.sources) } @@ -130,7 +131,7 @@ impl ConfigBuilder { /// # Errors /// If source collection fails, be it technical reasons or related to inability to read data as `Config` for different reasons, /// this method returns error. - pub fn build_cloned(&self) -> error::Result { + pub fn build_cloned(&self) -> Result { Self::build_internal(self.defaults.clone(), self.overrides.clone(), &self.sources) } @@ -138,7 +139,7 @@ impl ConfigBuilder { defaults: HashMap, overrides: HashMap, sources: &[Box], - ) -> error::Result { + ) -> Result { let mut cache: Value = HashMap::::new().into(); // Add defaults -- cgit v1.2.3