@@ -23,14 +23,12 @@ pub(crate) use self::{
23
23
config_loader:: ConfigLoader ,
24
24
diff_ignore_whitespace_setting:: DiffIgnoreWhitespaceSetting ,
25
25
diff_show_whitespace_setting:: DiffShowWhitespaceSetting ,
26
+ errors:: { ConfigError , ConfigErrorCause , InvalidColorError } ,
26
27
git_config:: GitConfig ,
27
28
key_bindings:: KeyBindings ,
28
29
theme:: Theme ,
29
30
} ;
30
- use crate :: config:: {
31
- errors:: { ConfigError , ConfigErrorCause , InvalidColorError } ,
32
- utils:: get_optional_string,
33
- } ;
31
+ use crate :: config:: utils:: get_optional_string;
34
32
35
33
const DEFAULT_SPACE_SYMBOL : & str = "\u{b7} " ; // ·
36
34
const DEFAULT_TAB_SYMBOL : & str = "\u{2192} " ; // →
@@ -94,22 +92,6 @@ impl Config {
94
92
}
95
93
}
96
94
97
- impl TryFrom < & ConfigLoader > for Config {
98
- type Error = ConfigError ;
99
-
100
- /// Creates a new Config instance loading the Git Config.
101
- ///
102
- /// # Errors
103
- ///
104
- /// Will return an `Err` if there is a problem loading the configuration.
105
- fn try_from ( config_loader : & ConfigLoader ) -> Result < Self , Self :: Error > {
106
- let config = config_loader
107
- . load_config ( )
108
- . map_err ( |e| ConfigError :: new_read_error ( "" , ConfigErrorCause :: GitError ( e) ) ) ?;
109
- Self :: new_with_config ( Some ( & config) )
110
- }
111
- }
112
-
113
95
impl TryFrom < & crate :: git:: Config > for Config {
114
96
type Error = ConfigError ;
115
97
@@ -132,7 +114,8 @@ mod tests {
132
114
fn try_from_config_loader ( ) {
133
115
with_temp_bare_repository ( |repository| {
134
116
let loader = ConfigLoader :: from ( repository) ;
135
- assert_ok ! ( Config :: try_from( & loader) ) ;
117
+ let config = assert_ok ! ( loader. load_config( ) ) ;
118
+ assert_ok ! ( Config :: try_from( & config) ) ;
136
119
} ) ;
137
120
}
138
121
0 commit comments