@@ -372,7 +372,7 @@ mod tests {
372
372
use test_utils:: assert_eq_text;
373
373
use text_edit:: TextEdit ;
374
374
375
- use crate :: { fixture, FileId } ;
375
+ use crate :: fixture;
376
376
377
377
use super :: { RangeInfo , RenameError } ;
378
378
@@ -400,18 +400,17 @@ mod tests {
400
400
match rename_result {
401
401
Ok ( source_change) => {
402
402
let mut text_edit_builder = TextEdit :: builder ( ) ;
403
- let mut file_id: Option < FileId > = None ;
404
- for edit in source_change. source_file_edits {
405
- file_id = Some ( edit. 0 ) ;
406
- for indel in edit. 1 . 0 . into_iter ( ) {
407
- text_edit_builder. replace ( indel. delete , indel. insert ) ;
408
- }
409
- }
410
- if let Some ( file_id) = file_id {
411
- let mut result = analysis. file_text ( file_id) . unwrap ( ) . to_string ( ) ;
412
- text_edit_builder. finish ( ) . apply ( & mut result) ;
413
- assert_eq_text ! ( ra_fixture_after, & * result) ;
403
+ let ( & file_id, edit) = match source_change. source_file_edits . len ( ) {
404
+ 0 => return ,
405
+ 1 => source_change. source_file_edits . iter ( ) . next ( ) . unwrap ( ) ,
406
+ _ => ( & position. file_id , & source_change. source_file_edits [ & position. file_id ] ) ,
407
+ } ;
408
+ for indel in edit. 0 . iter ( ) {
409
+ text_edit_builder. replace ( indel. delete , indel. insert . clone ( ) ) ;
414
410
}
411
+ let mut result = analysis. file_text ( file_id) . unwrap ( ) . to_string ( ) ;
412
+ text_edit_builder. finish ( ) . apply ( & mut result) ;
413
+ assert_eq_text ! ( ra_fixture_after, & * result) ;
415
414
}
416
415
Err ( err) => {
417
416
if ra_fixture_after. starts_with ( "error:" ) {
@@ -2649,7 +2648,7 @@ pub struct S;
2649
2648
//- /main.rs crate:main deps:lib new_source_root:local
2650
2649
use lib::S$0;
2651
2650
"# ,
2652
- "use lib::Baz;" ,
2651
+ "use lib::Baz;\n " ,
2653
2652
) ;
2654
2653
}
2655
2654
0 commit comments