File tree 1 file changed +11
-4
lines changed 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -96,9 +96,16 @@ fn resolve_config(dir: &Path) -> io::Result<(Config, Option<PathBuf>)> {
96
96
Ok ( ( Config :: from ( parsed_config) , Some ( path) ) )
97
97
}
98
98
99
- fn update_config ( config : & mut Config , matches : & Matches ) {
100
- config. verbose = matches. opt_present ( "verbose" ) ;
101
- config. skip_children = matches. opt_present ( "skip-children" ) ;
99
+ fn partial_config_from_options ( matches : & Matches ) -> PartialConfig {
100
+ let mut config = PartialConfig :: new ( ) ;
101
+ if matches. opt_present ( "skip_children" ) {
102
+ config. skip_children = Some ( true ) ;
103
+ }
104
+ if matches. opt_present ( "verbose" ) {
105
+ config. verbose = Some ( true ) ;
106
+ }
107
+
108
+ config
102
109
}
103
110
104
111
fn execute ( ) -> i32 {
@@ -156,13 +163,13 @@ fn execute() -> i32 {
156
163
let ( mut config, path) = resolve_config ( file. parent ( ) . unwrap ( ) )
157
164
. expect ( & format ! ( "Error resolving config for {}" ,
158
165
file. display( ) ) ) ;
166
+ config = config. merge ( & partial_config_from_options ( & matches) ) ;
159
167
if let Some ( path) = path {
160
168
println ! ( "Using rustfmt config file {} for {}" ,
161
169
path. display( ) ,
162
170
file. display( ) ) ;
163
171
}
164
172
165
- update_config ( & mut config, & matches) ;
166
173
run ( & file, write_mode, & config) ;
167
174
}
168
175
0
You can’t perform that action at this time.
0 commit comments