From 1baa23ddcc96f4794c245ff3193af7f612289a22 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sun, 24 Jan 2021 11:25:27 +0100 Subject: [PATCH] Change as_tag_tuple to work by reference --- CHANGELOG.md | 1 + src/algorithms/capture.rs | 4 ++-- src/lib.rs | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7576aff..d02acd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to similar are documented here. ## 0.3.0 * Added grapheme and character level diffing utilities. +* `DiffOp::as_tag_tuple` is now taking the argument by reference. ## 0.2.0 diff --git a/src/algorithms/capture.rs b/src/algorithms/capture.rs index 8e1d7e4..715b537 100644 --- a/src/algorithms/capture.rs +++ b/src/algorithms/capture.rs @@ -68,8 +68,8 @@ impl DiffOp { /// * `Delete`: `a[i1..i2]` should be deleted (`j1 == j2` in this case). /// * `Insert`: `b[j1..j2]` should be inserted at `a[i1..i2]` (`i1 == i2` in this case). /// * `Equal`: `a[i1..i2]` is equal to `b[j1..j2]`. - pub fn as_tag_tuple(self) -> (DiffTag, Range, Range) { - match self { + pub fn as_tag_tuple(&self) -> (DiffTag, Range, Range) { + match *self { DiffOp::Equal { old_index, new_index, diff --git a/src/lib.rs b/src/lib.rs index 1c1b0c7..70a1866 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,5 +28,6 @@ //! gains the ability to diff on a grapheme instead of character level. This //! is particularly useful when working with text containing emojis. //! * `text`: this feature is enabled by default and enables the [`text`] module. +//! If the crate is used without default features it's removed. pub mod algorithms; pub mod text;