File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -200,16 +200,23 @@ fn apply_suggestion(suggestion: &rustfix::Suggestion) -> Result<(), ProgramError
200
200
. take ( max ( suggestion. line_range . start . line - 1 , 0 ) as usize )
201
201
. collect :: < Vec < _ > > ( )
202
202
. join ( "\n " ) ) ;
203
- new_content. push_str ( "\n " ) ;
203
+
204
+ // Some suggestions seem to currently omit the trailing semicolon
205
+ let remember_a_semicolon = new_content. ends_with ( ';' ) ;
204
206
205
207
// Indentation
208
+ new_content. push_str ( "\n " ) ;
206
209
new_content. push_str ( & repeat ( " " )
207
210
. take ( suggestion. line_range . start . column - 1 as usize )
208
211
. collect :: < String > ( ) ) ;
209
212
210
213
// TODO(killercup): Replace sections of lines only
211
214
new_content. push_str ( suggestion. replacement . trim ( ) ) ;
212
215
216
+ if remember_a_semicolon {
217
+ new_content. push_str ( ";" ) ;
218
+ }
219
+
213
220
// Add the lines after the section we want to replace
214
221
new_content. push_str ( "\n " ) ;
215
222
new_content. push_str ( & file_content. lines ( )
You can’t perform that action at this time.
0 commit comments