diff options
Diffstat (limited to 'crates/ra_editor/src/test_utils.rs')
-rw-r--r-- | crates/ra_editor/src/test_utils.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ra_editor/src/test_utils.rs b/crates/ra_editor/src/test_utils.rs index bf40c92c0..dc2470aa3 100644 --- a/crates/ra_editor/src/test_utils.rs +++ b/crates/ra_editor/src/test_utils.rs | |||
@@ -13,7 +13,10 @@ pub fn check_action<F: Fn(&SourceFile, TextUnit) -> Option<LocalEdit>>( | |||
13 | let result = f(&file, before_cursor_pos).expect("code action is not applicable"); | 13 | let result = f(&file, before_cursor_pos).expect("code action is not applicable"); |
14 | let actual = result.edit.apply(&before); | 14 | let actual = result.edit.apply(&before); |
15 | let actual_cursor_pos = match result.cursor_position { | 15 | let actual_cursor_pos = match result.cursor_position { |
16 | None => result.edit.apply_to_offset(before_cursor_pos).unwrap(), | 16 | None => result |
17 | .edit | ||
18 | .apply_to_offset(before_cursor_pos) | ||
19 | .expect("cursor position is affected by the edit"), | ||
17 | Some(off) => off, | 20 | Some(off) => off, |
18 | }; | 21 | }; |
19 | let actual = add_cursor(&actual, actual_cursor_pos); | 22 | let actual = add_cursor(&actual, actual_cursor_pos); |