diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-02 13:08:16 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-02 13:08:16 +0000 |
commit | 0bdf8deb77e9066baa42acb98c99e9fc54e90634 (patch) | |
tree | 974d3df4adcf7fb0ef117f4274c7b5d337c57264 /crates/ra_editor/src/edit.rs | |
parent | bcc2342be6e0206bfd945967e168c08b9d373525 (diff) | |
parent | 270645683216c11a81b2b144576d9b18a0d947ad (diff) |
Merge #252
252: Improve 'introduce variable' r=matklad a=flodiebold
- make it possible to extract a prefix of an expression statement (e.g.
`<|>foo.bar()<|>.baz()`)
- don't turn the last expression in a block into a let statement
- also fix a few typos
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_editor/src/edit.rs')
-rw-r--r-- | crates/ra_editor/src/edit.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/ra_editor/src/edit.rs b/crates/ra_editor/src/edit.rs index c3149ec54..372b8d14c 100644 --- a/crates/ra_editor/src/edit.rs +++ b/crates/ra_editor/src/edit.rs | |||
@@ -26,7 +26,7 @@ impl EditBuilder { | |||
26 | } | 26 | } |
27 | pub fn finish(self) -> Edit { | 27 | pub fn finish(self) -> Edit { |
28 | let mut atoms = self.atoms; | 28 | let mut atoms = self.atoms; |
29 | atoms.sort_by_key(|a| a.delete.start()); | 29 | atoms.sort_by_key(|a| (a.delete.start(), a.delete.end())); |
30 | for (a1, a2) in atoms.iter().zip(atoms.iter().skip(1)) { | 30 | for (a1, a2) in atoms.iter().zip(atoms.iter().skip(1)) { |
31 | assert!(a1.delete.end() <= a2.delete.start()) | 31 | assert!(a1.delete.end() <= a2.delete.start()) |
32 | } | 32 | } |