@@ -23,14 +23,12 @@ pub(crate) use self::{
2323 config_loader:: ConfigLoader ,
2424 diff_ignore_whitespace_setting:: DiffIgnoreWhitespaceSetting ,
2525 diff_show_whitespace_setting:: DiffShowWhitespaceSetting ,
26+ errors:: { ConfigError , ConfigErrorCause , InvalidColorError } ,
2627 git_config:: GitConfig ,
2728 key_bindings:: KeyBindings ,
2829 theme:: Theme ,
2930} ;
30- use crate :: config:: {
31- errors:: { ConfigError , ConfigErrorCause , InvalidColorError } ,
32- utils:: get_optional_string,
33- } ;
31+ use crate :: config:: utils:: get_optional_string;
3432
3533const DEFAULT_SPACE_SYMBOL : & str = "\u{b7} " ; // ·
3634const DEFAULT_TAB_SYMBOL : & str = "\u{2192} " ; // →
@@ -94,22 +92,6 @@ impl Config {
9492 }
9593}
9694
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-
11395impl TryFrom < & crate :: git:: Config > for Config {
11496 type Error = ConfigError ;
11597
@@ -132,7 +114,8 @@ mod tests {
132114 fn try_from_config_loader ( ) {
133115 with_temp_bare_repository ( |repository| {
134116 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) ) ;
136119 } ) ;
137120 }
138121
0 commit comments