@@ -55,22 +55,20 @@ impl File {
55
55
56
56
let mut config_to_append = gix_config:: File :: new ( config. meta_owned ( ) ) ;
57
57
let mut prev_name = None ;
58
- let mut section = None ;
59
58
for ( ( module_name, field) , values) in values {
60
59
if prev_name. map_or ( true , |pn : & BStr | pn != module_name) {
61
- section. take ( ) ;
62
- section = Some (
63
- config_to_append
64
- . new_section ( "submodule" , Cow :: Owned ( module_name. to_owned ( ) ) )
65
- . expect ( "all names come from valid configuration, so remain valid" ) ,
66
- ) ;
60
+ config_to_append
61
+ . new_section ( "submodule" , Cow :: Owned ( module_name. to_owned ( ) ) )
62
+ . expect ( "all names come from valid configuration, so remain valid" ) ;
67
63
prev_name = Some ( module_name) ;
68
64
}
69
- let section = section. as_mut ( ) . expect ( "always set at this point" ) ;
70
- section. push (
71
- field. try_into ( ) . expect ( "statically known key" ) ,
72
- Some ( values. last ( ) . expect ( "at least one value or we wouldn't be here" ) ) ,
73
- ) ;
65
+ config_to_append
66
+ . section_mut ( "submodule" , Some ( module_name) )
67
+ . expect ( "always set at this point" )
68
+ . push (
69
+ field. try_into ( ) . expect ( "statically known key" ) ,
70
+ Some ( values. last ( ) . expect ( "at least one value or we wouldn't be here" ) ) ,
71
+ ) ;
74
72
}
75
73
76
74
self . config . append ( config_to_append) ;
0 commit comments