From b8aa7d5fce1501eab41da9e2d8abe989fe6dba39 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 18 Apr 2023 21:46:19 +0200 Subject: [PATCH] fix: temp value was dropped --- src/lib/operation/factory.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/operation/factory.rs b/src/lib/operation/factory.rs index 8035520..b8fa014 100644 --- a/src/lib/operation/factory.rs +++ b/src/lib/operation/factory.rs @@ -6,11 +6,12 @@ pub trait OperationFactory { fn replace(&self, txt: &str) -> OperationSeq { let mut out = OperationSeq::default(); - if self.content() == txt { + let content = self.content(); + if content == txt { return out; // TODO this won't work, should we return a noop instead? } - let diff = TextDiff::from_chars(self.content().as_str(), txt); + let diff = TextDiff::from_chars(content.as_str(), txt); for change in diff.iter_all_changes() { match change.tag() {