@@ -133,7 +133,13 @@ pub(crate) fn exec(command: Command) -> Result<()> {
133
133
MigrationStepKind :: Instruction ( instruction) => {
134
134
let occurrences_spans = instruction ( & program_info) ?;
135
135
136
- print_instruction_result ( & engines, max_len, feature, migration_step, & occurrences_spans) ;
136
+ print_instruction_result (
137
+ & engines,
138
+ max_len,
139
+ feature,
140
+ migration_step,
141
+ & occurrences_spans,
142
+ ) ;
137
143
138
144
if !occurrences_spans. is_empty ( ) {
139
145
println_yellow_bold ( "If you've already reviewed the above points, you can ignore this info." ) ;
@@ -142,25 +148,58 @@ pub(crate) fn exec(command: Command) -> Result<()> {
142
148
MigrationStepKind :: CodeModification ( modification, manual_migration_actions) => {
143
149
let occurrences_spans = modification ( & mut program_info. as_mut ( ) , DryRun :: No ) ?;
144
150
145
- output_modified_modules ( & build_instructions. manifest_dir ( ) ?, & program_info, & occurrences_spans) ?;
146
-
147
- let stop_migration_process = print_modification_result ( max_len, feature, migration_step, manual_migration_actions, & occurrences_spans, & mut current_feature_migration_has_code_changes) ;
151
+ output_modified_modules (
152
+ & build_instructions. manifest_dir ( ) ?,
153
+ & program_info,
154
+ & occurrences_spans,
155
+ ) ?;
156
+
157
+ let stop_migration_process = print_modification_result (
158
+ max_len,
159
+ feature,
160
+ migration_step,
161
+ manual_migration_actions,
162
+ & occurrences_spans,
163
+ & mut current_feature_migration_has_code_changes,
164
+ ) ;
148
165
if stop_migration_process == StopMigrationProcess :: Yes {
149
166
return Ok ( ( ) ) ;
150
167
}
151
168
}
152
- MigrationStepKind :: Interaction ( instruction, interaction, manual_migration_actions) => {
169
+ MigrationStepKind :: Interaction (
170
+ instruction,
171
+ interaction,
172
+ manual_migration_actions,
173
+ ) => {
153
174
let instruction_occurrences_spans = instruction ( & program_info) ?;
154
175
155
- print_instruction_result ( & engines, max_len, feature, migration_step, & instruction_occurrences_spans) ;
176
+ print_instruction_result (
177
+ & engines,
178
+ max_len,
179
+ feature,
180
+ migration_step,
181
+ & instruction_occurrences_spans,
182
+ ) ;
156
183
157
184
// We have occurrences, let's continue with the interaction.
158
185
if !instruction_occurrences_spans. is_empty ( ) {
159
- let interaction_occurrences_spans = interaction ( & mut program_info. as_mut ( ) ) ?;
160
-
161
- output_modified_modules ( & build_instructions. manifest_dir ( ) ?, & program_info, & interaction_occurrences_spans) ?;
162
-
163
- let stop_migration_process = print_modification_result ( max_len, feature, migration_step, manual_migration_actions, & interaction_occurrences_spans, & mut current_feature_migration_has_code_changes) ;
186
+ let interaction_occurrences_spans =
187
+ interaction ( & mut program_info. as_mut ( ) ) ?;
188
+
189
+ output_modified_modules (
190
+ & build_instructions. manifest_dir ( ) ?,
191
+ & program_info,
192
+ & interaction_occurrences_spans,
193
+ ) ?;
194
+
195
+ let stop_migration_process = print_modification_result (
196
+ max_len,
197
+ feature,
198
+ migration_step,
199
+ manual_migration_actions,
200
+ & interaction_occurrences_spans,
201
+ & mut current_feature_migration_has_code_changes,
202
+ ) ;
164
203
if stop_migration_process == StopMigrationProcess :: Yes {
165
204
return Ok ( ( ) ) ;
166
205
}
@@ -196,7 +235,14 @@ enum StopMigrationProcess {
196
235
No ,
197
236
}
198
237
199
- fn print_modification_result ( max_len : usize , feature : & Feature , migration_step : & MigrationStep , manual_migration_actions : & [ & str ] , occurrences_spans : & [ Span ] , current_feature_migration_has_code_changes : & mut bool ) -> StopMigrationProcess {
238
+ fn print_modification_result (
239
+ max_len : usize ,
240
+ feature : & Feature ,
241
+ migration_step : & MigrationStep ,
242
+ manual_migration_actions : & [ & str ] ,
243
+ occurrences_spans : & [ Span ] ,
244
+ current_feature_migration_has_code_changes : & mut bool ,
245
+ ) -> StopMigrationProcess {
200
246
if occurrences_spans. is_empty ( ) {
201
247
print_checked_action ( max_len, feature, migration_step) ;
202
248
StopMigrationProcess :: No
@@ -233,18 +279,21 @@ fn print_modification_result(max_len: usize, feature: &Feature, migration_step:
233
279
}
234
280
}
235
281
236
- fn print_instruction_result ( engines : & Engines , max_len : usize , feature : & Feature , migration_step : & MigrationStep , occurrences_spans : & [ Span ] ) {
282
+ fn print_instruction_result (
283
+ engines : & Engines ,
284
+ max_len : usize ,
285
+ feature : & Feature ,
286
+ migration_step : & MigrationStep ,
287
+ occurrences_spans : & [ Span ] ,
288
+ ) {
237
289
if occurrences_spans. is_empty ( ) {
238
290
print_checked_action ( max_len, feature, migration_step) ;
239
291
} else {
240
292
print_review_action ( max_len, feature, migration_step) ;
241
293
242
- if let Some ( diagnostic) = create_migration_diagnostic (
243
- engines. se ( ) ,
244
- feature,
245
- migration_step,
246
- & occurrences_spans,
247
- ) {
294
+ if let Some ( diagnostic) =
295
+ create_migration_diagnostic ( engines. se ( ) , feature, migration_step, occurrences_spans)
296
+ {
248
297
format_diagnostic ( & diagnostic) ;
249
298
}
250
299
}
@@ -254,21 +303,20 @@ fn print_instruction_result(engines: &Engines, max_len: usize, feature: &Feature
254
303
///
255
304
/// A module is considered modified, if any of the [Span]s in `occurrences_spans`
256
305
/// has that module as its source.
257
- fn output_modified_modules ( manifest_dir : & Path , program_info : & ProgramInfo , occurrences_spans : & [ Span ] ) -> Result < ( ) > {
306
+ fn output_modified_modules (
307
+ manifest_dir : & Path ,
308
+ program_info : & ProgramInfo ,
309
+ occurrences_spans : & [ Span ] ,
310
+ ) -> Result < ( ) > {
258
311
if occurrences_spans. is_empty ( ) {
259
312
return Ok ( ( ) ) ;
260
313
}
261
314
262
- let modified_modules =
263
- ModifiedModules :: new ( program_info. engines . se ( ) , occurrences_spans) ;
315
+ let modified_modules = ModifiedModules :: new ( program_info. engines . se ( ) , occurrences_spans) ;
264
316
265
317
check_that_modified_modules_are_not_dirty ( & modified_modules) ?;
266
318
267
- output_changed_lexed_program (
268
- manifest_dir,
269
- & modified_modules,
270
- & program_info. lexed_program ,
271
- ) ?;
319
+ output_changed_lexed_program ( manifest_dir, & modified_modules, & program_info. lexed_program ) ?;
272
320
273
321
Ok ( ( ) )
274
322
}
0 commit comments