From 270645683216c11a81b2b144576d9b18a0d947ad Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 2 Dec 2018 14:00:46 +0100 Subject: Improve 'introduce variable' - 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 --- crates/ra_editor/src/edit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_editor/src/edit.rs') 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 { } pub fn finish(self) -> Edit { let mut atoms = self.atoms; - atoms.sort_by_key(|a| a.delete.start()); + atoms.sort_by_key(|a| (a.delete.start(), a.delete.end())); for (a1, a2) in atoms.iter().zip(atoms.iter().skip(1)) { assert!(a1.delete.end() <= a2.delete.start()) } -- cgit v1.2.3