Skip to content

Commit ddc41bf

Browse files
committed
Refactor: Import Result and use it instead of specifying full type path
Signed-off-by: Matthias Beyer <[email protected]>
1 parent 49f935a commit ddc41bf

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/builder.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use std::str::FromStr;
22
use std::{collections::HashMap, iter::IntoIterator};
33

4-
use crate::{config::Config, error, path::Expression, source::Source, value::Value};
4+
use crate::error::Result;
5+
use crate::{config::Config, path::Expression, source::Source, value::Value};
56

67
/// A configuration builder
78
///
@@ -72,7 +73,7 @@ impl ConfigBuilder {
7273
/// # Errors
7374
///
7475
/// Fails if `Expression::from_str(key)` fails.
75-
pub fn set_default<S, T>(mut self, key: S, value: T) -> error::Result<ConfigBuilder>
76+
pub fn set_default<S, T>(mut self, key: S, value: T) -> Result<ConfigBuilder>
7677
where
7778
S: AsRef<str>,
7879
T: Into<Value>,
@@ -100,7 +101,7 @@ impl ConfigBuilder {
100101
/// # Errors
101102
///
102103
/// Fails if `Expression::from_str(key)` fails.
103-
pub fn set_override<S, T>(mut self, key: S, value: T) -> error::Result<ConfigBuilder>
104+
pub fn set_override<S, T>(mut self, key: S, value: T) -> Result<ConfigBuilder>
104105
where
105106
S: AsRef<str>,
106107
T: Into<Value>,
@@ -118,7 +119,7 @@ impl ConfigBuilder {
118119
/// # Errors
119120
/// If source collection fails, be it technical reasons or related to inability to read data as `Config` for different reasons,
120121
/// this method returns error.
121-
pub fn build(self) -> error::Result<Config> {
122+
pub fn build(self) -> Result<Config> {
122123
Self::build_internal(self.defaults, self.overrides, &self.sources)
123124
}
124125

@@ -130,15 +131,15 @@ impl ConfigBuilder {
130131
/// # Errors
131132
/// If source collection fails, be it technical reasons or related to inability to read data as `Config` for different reasons,
132133
/// this method returns error.
133-
pub fn build_cloned(&self) -> error::Result<Config> {
134+
pub fn build_cloned(&self) -> Result<Config> {
134135
Self::build_internal(self.defaults.clone(), self.overrides.clone(), &self.sources)
135136
}
136137

137138
fn build_internal(
138139
defaults: HashMap<Expression, Value>,
139140
overrides: HashMap<Expression, Value>,
140141
sources: &[Box<dyn Source + Send + Sync>],
141-
) -> error::Result<Config> {
142+
) -> Result<Config> {
142143
let mut cache: Value = HashMap::<String, Value>::new().into();
143144

144145
// Add defaults

0 commit comments

Comments
 (0)