From e668ff8bcd338cb649e0b8ee4a8c34f21cc7e791 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 1 Dec 2021 16:47:04 +0100 Subject: [PATCH] Avoid allocating a `Patch` just to check if there are no edits Co-Authored-By: Nathan Sobo --- crates/language/src/buffer.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs index 29c092c3ce..55346fc9dd 100644 --- a/crates/language/src/buffer.rs +++ b/crates/language/src/buffer.rs @@ -1326,8 +1326,7 @@ impl Buffer { was_dirty: bool, cx: &mut ModelContext, ) { - let patch = Patch::new(self.edits_since::(old_version).collect()); - if patch.is_empty() { + if self.edits_since::(old_version).next().is_none() { return; }