File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 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>)> {
9696 Ok ( ( Config :: from ( parsed_config) , Some ( path) ) )
9797}
9898
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
102109}
103110
104111fn execute ( ) -> i32 {
@@ -156,13 +163,13 @@ fn execute() -> i32 {
156163 let ( mut config, path) = resolve_config ( file. parent ( ) . unwrap ( ) )
157164 . expect ( & format ! ( "Error resolving config for {}" ,
158165 file. display( ) ) ) ;
166+ config = config. merge ( & partial_config_from_options ( & matches) ) ;
159167 if let Some ( path) = path {
160168 println ! ( "Using rustfmt config file {} for {}" ,
161169 path. display( ) ,
162170 file. display( ) ) ;
163171 }
164172
165- update_config ( & mut config, & matches) ;
166173 run ( & file, write_mode, & config) ;
167174 }
168175 0
You can’t perform that action at this time.
0 commit comments