From 7e86fb2e5583163321417f7b28fc70b21a0f5ded Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Thu, 11 Sep 2025 13:31:09 -0500 Subject: [PATCH] feat: rename similar -> likewise --- Cargo.toml | 7 +- README.md | 23 ++-- examples/close-matches.rs | 2 +- examples/large.rs | 2 +- examples/nonstring.rs | 2 +- examples/original-slices.rs | 4 +- examples/patience.rs | 2 +- examples/serde.rs | 2 +- examples/terminal-inline.rs | 2 +- examples/terminal.rs | 2 +- examples/udiff.rs | 2 +- src/algorithms/mod.rs | 2 +- ...ms__capture__capture_hook_grouping-2.snap} | 0 ...thms__capture__capture_hook_grouping.snap} | 0 ...ikewise__algorithms__lcs__contiguous.snap} | 0 ...p => likewise__algorithms__lcs__diff.snap} | 0 ...ap => likewise__algorithms__lcs__pat.snap} | 0 ...p => likewise__algorithms__lcs__same.snap} | 1 - ...ewise__algorithms__myers__contiguous.snap} | 0 ..._algorithms__myers__deadline_reached.snap} | 0 ...=> likewise__algorithms__myers__diff.snap} | 0 ... => likewise__algorithms__myers__pat.snap} | 0 ...wise__algorithms__patience__patience.snap} | 0 ...patience__patience_out_of_bounds_bug.snap} | 0 src/algorithms/utils.rs | 4 +- src/lib.rs | 10 +- ...nap => likewise__udiff__unified_diff.snap} | 1 - ...__udiff__unified_diff_newline_hint-2.snap} | 3 +- ...se__udiff__unified_diff_newline_hint.snap} | 1 - src/text/mod.rs | 16 +-- ...snap => likewise__text__captured_ops.snap} | 0 ...=> likewise__text__captured_word_ops.snap} | 0 ...ff.snap => likewise__text__char_diff.snap} | 0 ...=> likewise__text__lifetimes_on_iter.snap} | 0 ...ops.snap => likewise__text__line_ops.snap} | 0 ...snap => likewise__text__unified_diff.snap} | 1 - ... => likewise__text__virtual_newlines.snap} | 0 ...imilar__text__inline__line_ops_inline.snap | 126 ------------------ .../similar__text__inline__serde.snap | 107 --------------- src/text/snapshots/similar__text__serde.snap | 55 -------- .../snapshots/similar__text__serde_ops.snap | 38 ------ src/types.rs | 8 +- src/udiff.rs | 4 +- src/utils.rs | 28 ++-- 44 files changed, 64 insertions(+), 391 deletions(-) rename src/algorithms/snapshots/{similar__algorithms__capture__capture_hook_grouping-2.snap => likewise__algorithms__capture__capture_hook_grouping-2.snap} (100%) rename src/algorithms/snapshots/{similar__algorithms__capture__capture_hook_grouping.snap => likewise__algorithms__capture__capture_hook_grouping.snap} (100%) rename src/algorithms/snapshots/{similar__algorithms__lcs__contiguous.snap => likewise__algorithms__lcs__contiguous.snap} (100%) rename src/algorithms/snapshots/{similar__algorithms__lcs__diff.snap => likewise__algorithms__lcs__diff.snap} (100%) rename src/algorithms/snapshots/{similar__algorithms__lcs__pat.snap => likewise__algorithms__lcs__pat.snap} (100%) rename src/algorithms/snapshots/{similar__algorithms__lcs__same.snap => likewise__algorithms__lcs__same.snap} (87%) rename src/algorithms/snapshots/{similar__algorithms__myers__contiguous.snap => likewise__algorithms__myers__contiguous.snap} (100%) rename src/algorithms/snapshots/{similar__algorithms__myers__deadline_reached.snap => likewise__algorithms__myers__deadline_reached.snap} (100%) rename src/algorithms/snapshots/{similar__algorithms__myers__diff.snap => likewise__algorithms__myers__diff.snap} (100%) rename src/algorithms/snapshots/{similar__algorithms__myers__pat.snap => likewise__algorithms__myers__pat.snap} (100%) rename src/algorithms/snapshots/{similar__algorithms__patience__patience.snap => likewise__algorithms__patience__patience.snap} (100%) rename src/algorithms/snapshots/{similar__algorithms__patience__patience_out_of_bounds_bug.snap => likewise__algorithms__patience__patience_out_of_bounds_bug.snap} (100%) rename src/snapshots/{similar__udiff__unified_diff.snap => likewise__udiff__unified_diff.snap} (99%) rename src/snapshots/{similar__udiff__unified_diff_newline_hint-2.snap => likewise__udiff__unified_diff_newline_hint-2.snap} (57%) rename src/snapshots/{similar__udiff__unified_diff_newline_hint.snap => likewise__udiff__unified_diff_newline_hint.snap} (99%) rename src/text/snapshots/{similar__text__captured_ops.snap => likewise__text__captured_ops.snap} (100%) rename src/text/snapshots/{similar__text__captured_word_ops.snap => likewise__text__captured_word_ops.snap} (100%) rename src/text/snapshots/{similar__text__char_diff.snap => likewise__text__char_diff.snap} (100%) rename src/text/snapshots/{similar__text__lifetimes_on_iter.snap => likewise__text__lifetimes_on_iter.snap} (100%) rename src/text/snapshots/{similar__text__line_ops.snap => likewise__text__line_ops.snap} (100%) rename src/text/snapshots/{similar__text__unified_diff.snap => likewise__text__unified_diff.snap} (99%) rename src/text/snapshots/{similar__text__virtual_newlines.snap => likewise__text__virtual_newlines.snap} (100%) delete mode 100644 src/text/snapshots/similar__text__inline__line_ops_inline.snap delete mode 100644 src/text/snapshots/similar__text__inline__serde.snap delete mode 100644 src/text/snapshots/similar__text__serde.snap delete mode 100644 src/text/snapshots/similar__text__serde_ops.snap diff --git a/Cargo.toml b/Cargo.toml index b7ee0d5..d6e5ff4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "similar" +name = "likewise" version = "2.7.0" authors = [ + "Barrett Ruth ", "Armin Ronacher ", "Pierre-Γ‰tienne Meunier ", "Brandon Williams ", @@ -9,8 +10,8 @@ authors = [ edition = "2018" rust-version = "1.60" license = "Apache-2.0" -description = "A diff library for Rust" -repository = "https://github.com/mitsuhiko/similar" +description = "A diff library for Rust (fork of similar)" +repository = "https://github.com/barrett-ruth/likewise" keywords = ["diff", "difference", "patience", "compare", "changes"] readme = "README.md" exclude = ["assets/*"] diff --git a/README.md b/README.md index dd5c37f..61dc646 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ -# Similar: A Diffing Library +# Likewise: A Diffing Library -[![Crates.io](https://img.shields.io/crates/d/similar.svg)](https://crates.io/crates/similar) -[![License](https://img.shields.io/github/license/mitsuhiko/similar)](https://github.com/mitsuhiko/similar/blob/main/LICENSE) +> This crate is a fork of [similar](https://github.com/mitsuhiko/similar) library, which, as of 11/9/25, is rather inactive. + +[![Crates.io](https://img.shields.io/crates/d/likewise.svg)](https://crates.io/crates/likewise) +[![License](https://img.shields.io/github/license/frozen/likewise)](https://github.com/frozen/likewise/blob/main/LICENSE) [![rustc 1.60.0](https://img.shields.io/badge/rust-1.60%2B-orange.svg)](https://img.shields.io/badge/rust-1.60%2B-orange.svg) -[![Documentation](https://docs.rs/similar/badge.svg)](https://docs.rs/similar) +[![Documentation](https://docs.rs/likewise/badge.svg)](https://docs.rs/likewise) -Similar is a dependency free crate for Rust that implements different diffing +Likewise is a dependency free crate for Rust that implements different diffing algorithms and high level interfaces for it. It is based on the [pijul](https://pijul.org/) implementation of the Patience algorithm and inherits some ideas from there. It also incorporates the Myers' diff @@ -13,7 +15,7 @@ algorithm which was largely written by Brandon Williams. This library was built for the [insta snapshot testing library](https://insta.rs). ```rust -use similar::{ChangeTag, TextDiff}; +use likewise::{ChangeTag, TextDiff}; fn main() { let diff = TextDiff::from_lines( @@ -48,12 +50,13 @@ fn main() { ## Related Projects +* [similar](https://github.com/mitsuhiko/similar) * [insta](https://insta.rs) snapshot testing library * [similar-asserts](https://github.com/mitsuhiko/similar-asserts) assertion library ## License and Links -* [Documentation](https://docs.rs/similar/) -* [Issue Tracker](https://github.com/mitsuhiko/similar/issues) -* [Examples](https://github.com/mitsuhiko/similar/tree/main/examples) -* License: [Apache-2.0](https://github.com/mitsuhiko/similar/blob/main/LICENSE) +* [Documentation](https://docs.rs/likewise/) +* [Issue Tracker](https://github.com/barrett-ruth/likewise/issues) +* [Examples](https://github.com/barrett-ruth/likewise/tree/main/examples) +* License: [Apache-2.0](https://github.com/barrett-ruth/likewise/blob/main/LICENSE) diff --git a/examples/close-matches.rs b/examples/close-matches.rs index ebe283a..19293fc 100644 --- a/examples/close-matches.rs +++ b/examples/close-matches.rs @@ -1,4 +1,4 @@ -use similar::get_close_matches; +use likewise::get_close_matches; fn main() { let words = vec![ diff --git a/examples/large.rs b/examples/large.rs index 08200f8..383f7d9 100644 --- a/examples/large.rs +++ b/examples/large.rs @@ -1,4 +1,4 @@ -use similar::TextDiff; +use likewise::TextDiff; fn main() { let x = "abc".repeat(2000); diff --git a/examples/nonstring.rs b/examples/nonstring.rs index ca102e2..66a84fe 100644 --- a/examples/nonstring.rs +++ b/examples/nonstring.rs @@ -1,4 +1,4 @@ -use similar::{capture_diff_slices, Algorithm}; +use likewise::{capture_diff_slices, Algorithm}; fn main() { let old = vec![1, 2, 3]; diff --git a/examples/original-slices.rs b/examples/original-slices.rs index bdca420..81b0337 100644 --- a/examples/original-slices.rs +++ b/examples/original-slices.rs @@ -1,5 +1,5 @@ -use similar::utils::diff_chars; -use similar::Algorithm; +use likewise::utils::diff_chars; +use likewise::Algorithm; fn main() { let old = "1234567890abcdef".to_string(); diff --git a/examples/patience.rs b/examples/patience.rs index 4b898a6..2c63f6f 100644 --- a/examples/patience.rs +++ b/examples/patience.rs @@ -1,4 +1,4 @@ -use similar::{Algorithm, TextDiff}; +use likewise::{Algorithm, TextDiff}; const OLD: &str = r#" [ diff --git a/examples/serde.rs b/examples/serde.rs index 98a5818..a671f23 100644 --- a/examples/serde.rs +++ b/examples/serde.rs @@ -1,4 +1,4 @@ -use similar::TextDiff; +use likewise::TextDiff; fn main() { let diff = TextDiff::from_lines( diff --git a/examples/terminal-inline.rs b/examples/terminal-inline.rs index 4c5d74f..5168e7f 100644 --- a/examples/terminal-inline.rs +++ b/examples/terminal-inline.rs @@ -3,7 +3,7 @@ use std::fs::read; use std::process::exit; use console::{style, Style}; -use similar::{ChangeTag, TextDiff}; +use likewise::{ChangeTag, TextDiff}; struct Line(Option); diff --git a/examples/terminal.rs b/examples/terminal.rs index 1a90327..3743d39 100644 --- a/examples/terminal.rs +++ b/examples/terminal.rs @@ -1,5 +1,5 @@ use console::Style; -use similar::{ChangeTag, TextDiff}; +use likewise::{ChangeTag, TextDiff}; fn main() { let diff = TextDiff::from_lines( diff --git a/examples/udiff.rs b/examples/udiff.rs index 3d8eb9c..44f9429 100644 --- a/examples/udiff.rs +++ b/examples/udiff.rs @@ -2,7 +2,7 @@ use std::fs::read; use std::io; use std::process::exit; -use similar::TextDiff; +use likewise::TextDiff; fn main() { let args: Vec<_> = std::env::args_os().collect(); diff --git a/src/algorithms/mod.rs b/src/algorithms/mod.rs index 008ade5..0a43afc 100644 --- a/src/algorithms/mod.rs +++ b/src/algorithms/mod.rs @@ -21,7 +21,7 @@ //! between two sequences and capture the ops into a vector. //! //! ```rust -//! use similar::algorithms::{Algorithm, Replace, Capture, diff_slices}; +//! use likewise::algorithms::{Algorithm, Replace, Capture, diff_slices}; //! //! let a = vec![1, 2, 3, 4, 5]; //! let b = vec![1, 2, 3, 4, 7]; diff --git a/src/algorithms/snapshots/similar__algorithms__capture__capture_hook_grouping-2.snap b/src/algorithms/snapshots/likewise__algorithms__capture__capture_hook_grouping-2.snap similarity index 100% rename from src/algorithms/snapshots/similar__algorithms__capture__capture_hook_grouping-2.snap rename to src/algorithms/snapshots/likewise__algorithms__capture__capture_hook_grouping-2.snap diff --git a/src/algorithms/snapshots/similar__algorithms__capture__capture_hook_grouping.snap b/src/algorithms/snapshots/likewise__algorithms__capture__capture_hook_grouping.snap similarity index 100% rename from src/algorithms/snapshots/similar__algorithms__capture__capture_hook_grouping.snap rename to src/algorithms/snapshots/likewise__algorithms__capture__capture_hook_grouping.snap diff --git a/src/algorithms/snapshots/similar__algorithms__lcs__contiguous.snap b/src/algorithms/snapshots/likewise__algorithms__lcs__contiguous.snap similarity index 100% rename from src/algorithms/snapshots/similar__algorithms__lcs__contiguous.snap rename to src/algorithms/snapshots/likewise__algorithms__lcs__contiguous.snap diff --git a/src/algorithms/snapshots/similar__algorithms__lcs__diff.snap b/src/algorithms/snapshots/likewise__algorithms__lcs__diff.snap similarity index 100% rename from src/algorithms/snapshots/similar__algorithms__lcs__diff.snap rename to src/algorithms/snapshots/likewise__algorithms__lcs__diff.snap diff --git a/src/algorithms/snapshots/similar__algorithms__lcs__pat.snap b/src/algorithms/snapshots/likewise__algorithms__lcs__pat.snap similarity index 100% rename from src/algorithms/snapshots/similar__algorithms__lcs__pat.snap rename to src/algorithms/snapshots/likewise__algorithms__lcs__pat.snap diff --git a/src/algorithms/snapshots/similar__algorithms__lcs__same.snap b/src/algorithms/snapshots/likewise__algorithms__lcs__same.snap similarity index 87% rename from src/algorithms/snapshots/similar__algorithms__lcs__same.snap rename to src/algorithms/snapshots/likewise__algorithms__lcs__same.snap index 4b9511b..08568f7 100644 --- a/src/algorithms/snapshots/similar__algorithms__lcs__same.snap +++ b/src/algorithms/snapshots/likewise__algorithms__lcs__same.snap @@ -1,6 +1,5 @@ --- source: src/algorithms/lcs.rs -assertion_line: 235 expression: d.ops() --- [ diff --git a/src/algorithms/snapshots/similar__algorithms__myers__contiguous.snap b/src/algorithms/snapshots/likewise__algorithms__myers__contiguous.snap similarity index 100% rename from src/algorithms/snapshots/similar__algorithms__myers__contiguous.snap rename to src/algorithms/snapshots/likewise__algorithms__myers__contiguous.snap diff --git a/src/algorithms/snapshots/similar__algorithms__myers__deadline_reached.snap b/src/algorithms/snapshots/likewise__algorithms__myers__deadline_reached.snap similarity index 100% rename from src/algorithms/snapshots/similar__algorithms__myers__deadline_reached.snap rename to src/algorithms/snapshots/likewise__algorithms__myers__deadline_reached.snap diff --git a/src/algorithms/snapshots/similar__algorithms__myers__diff.snap b/src/algorithms/snapshots/likewise__algorithms__myers__diff.snap similarity index 100% rename from src/algorithms/snapshots/similar__algorithms__myers__diff.snap rename to src/algorithms/snapshots/likewise__algorithms__myers__diff.snap diff --git a/src/algorithms/snapshots/similar__algorithms__myers__pat.snap b/src/algorithms/snapshots/likewise__algorithms__myers__pat.snap similarity index 100% rename from src/algorithms/snapshots/similar__algorithms__myers__pat.snap rename to src/algorithms/snapshots/likewise__algorithms__myers__pat.snap diff --git a/src/algorithms/snapshots/similar__algorithms__patience__patience.snap b/src/algorithms/snapshots/likewise__algorithms__patience__patience.snap similarity index 100% rename from src/algorithms/snapshots/similar__algorithms__patience__patience.snap rename to src/algorithms/snapshots/likewise__algorithms__patience__patience.snap diff --git a/src/algorithms/snapshots/similar__algorithms__patience__patience_out_of_bounds_bug.snap b/src/algorithms/snapshots/likewise__algorithms__patience__patience_out_of_bounds_bug.snap similarity index 100% rename from src/algorithms/snapshots/similar__algorithms__patience__patience_out_of_bounds_bug.snap rename to src/algorithms/snapshots/likewise__algorithms__patience__patience_out_of_bounds_bug.snap diff --git a/src/algorithms/utils.rs b/src/algorithms/utils.rs index 76b8895..13501d0 100644 --- a/src/algorithms/utils.rs +++ b/src/algorithms/utils.rs @@ -166,8 +166,8 @@ impl Index for OffsetLookup { /// you first pass it via [`IdentifyDistinct`]: /// /// ```rust -/// use similar::capture_diff; -/// use similar::algorithms::{Algorithm, IdentifyDistinct}; +/// use likewise::capture_diff; +/// use likewise::algorithms::{Algorithm, IdentifyDistinct}; /// /// let old = &["foo", "bar", "baz"][..]; /// let new = &["foo", "blah", "baz"][..]; diff --git a/src/lib.rs b/src/lib.rs index 32eaec6..d0e2aff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,7 +21,7 @@ //! diff an indexable object or slice and return a vector of [`DiffOp`] objects. //! //! ```rust -//! use similar::{Algorithm, capture_diff_slices}; +//! use likewise::{Algorithm, capture_diff_slices}; //! //! let a = vec![1, 2, 3, 4, 5]; //! let b = vec![1, 2, 3, 4, 7]; @@ -30,14 +30,14 @@ //! //! # Text Diffing //! -//! Similar provides helpful utilities for text (and more specifically line) diff +//! Likewise provides helpful utilities for text (and more specifically line) diff //! operations. The main type you want to work with is [`TextDiff`] which //! uses the underlying diff algorithms to expose a convenient API to work with //! texts: //! //! ```rust //! # #[cfg(feature = "text")] { -//! use similar::{ChangeTag, TextDiff}; +//! use likewise::{ChangeTag, TextDiff}; //! //! let diff = TextDiff::from_lines( //! "Hello World\nThis is the second line.\nThis is the third.", @@ -64,7 +64,7 @@ //! As a result there is a difference between `foo\n` and `foo` as far as diffs //! are concerned. //! -//! In similar this is handled on the [`Change`] or [`InlineChange`] level. If +//! In likewise this is handled on the [`Change`] or [`InlineChange`] level. If //! a diff was created via [`TextDiff::from_lines`] the text diffing system is //! instructed to check if there are missing newlines encountered //! ([`TextDiff::newline_terminated`] returns true). @@ -122,7 +122,7 @@ //! when performing a text diff. //! //! Note that on wasm targets calling [`Instant::now`] will result in a panic -//! unless you enable the `wasm32_web_time` feataure. By default similar will +//! unless you enable the `wasm32_web_time` feataure. By default likewise will //! silently disable the deadline checks internally unless that feature is //! enabled. //! diff --git a/src/snapshots/similar__udiff__unified_diff.snap b/src/snapshots/likewise__udiff__unified_diff.snap similarity index 99% rename from src/snapshots/similar__udiff__unified_diff.snap rename to src/snapshots/likewise__udiff__unified_diff.snap index 5345b0b..ae7a8fb 100644 --- a/src/snapshots/similar__udiff__unified_diff.snap +++ b/src/snapshots/likewise__udiff__unified_diff.snap @@ -22,4 +22,3 @@ expression: "&diff.unified_diff().header(\"a.txt\", \"b.txt\").to_string()" P Q R - diff --git a/src/snapshots/similar__udiff__unified_diff_newline_hint-2.snap b/src/snapshots/likewise__udiff__unified_diff_newline_hint-2.snap similarity index 57% rename from src/snapshots/similar__udiff__unified_diff_newline_hint-2.snap rename to src/snapshots/likewise__udiff__unified_diff_newline_hint-2.snap index 9a5d922..a189752 100644 --- a/src/snapshots/similar__udiff__unified_diff_newline_hint-2.snap +++ b/src/snapshots/likewise__udiff__unified_diff_newline_hint-2.snap @@ -1,10 +1,9 @@ --- source: src/udiff.rs -expression: "&diff.unified_diff().missing_newline_hint(false).header(\"a.txt\",\n \"b.txt\").to_string()" +expression: "&diff.unified_diff().missing_newline_hint(false).header(\"a.txt\",\n\"b.txt\").to_string()" --- --- a.txt +++ b.txt @@ -1 +1 @@ -a +b - diff --git a/src/snapshots/similar__udiff__unified_diff_newline_hint.snap b/src/snapshots/likewise__udiff__unified_diff_newline_hint.snap similarity index 99% rename from src/snapshots/similar__udiff__unified_diff_newline_hint.snap rename to src/snapshots/likewise__udiff__unified_diff_newline_hint.snap index d181b28..928b811 100644 --- a/src/snapshots/similar__udiff__unified_diff_newline_hint.snap +++ b/src/snapshots/likewise__udiff__unified_diff_newline_hint.snap @@ -8,4 +8,3 @@ expression: "&diff.unified_diff().header(\"a.txt\", \"b.txt\").to_string()" -a +b \ No newline at end of file - diff --git a/src/text/mod.rs b/src/text/mod.rs index f61a237..c724fae 100644 --- a/src/text/mod.rs +++ b/src/text/mod.rs @@ -93,7 +93,7 @@ impl TextDiffConfig { /// influence the behavior of unified diff generation. /// /// ```rust - /// use similar::{TextDiff, ChangeTag}; + /// use likewise::{TextDiff, ChangeTag}; /// /// let diff = TextDiff::configure().diff_lines("a\nb\nc", "a\nb\nC"); /// let changes: Vec<_> = diff @@ -131,7 +131,7 @@ impl TextDiffConfig { /// which lets you remap the diffs back to the original input strings. /// /// ```rust - /// use similar::{TextDiff, ChangeTag}; + /// use likewise::{TextDiff, ChangeTag}; /// /// let diff = TextDiff::configure().diff_words("foo bar baz", "foo BAR baz"); /// let changes: Vec<_> = diff @@ -169,7 +169,7 @@ impl TextDiffConfig { /// which lets you remap the diffs back to the original input strings. /// /// ```rust - /// use similar::{TextDiff, ChangeTag}; + /// use likewise::{TextDiff, ChangeTag}; /// /// let diff = TextDiff::configure().diff_chars("abcdef", "abcDDf"); /// let changes: Vec<_> = diff @@ -215,7 +215,7 @@ impl TextDiffConfig { /// which lets you remap the diffs back to the original input strings. /// /// ```rust - /// use similar::{TextDiff, ChangeTag}; + /// use likewise::{TextDiff, ChangeTag}; /// /// let diff = TextDiff::configure().diff_unicode_words("ah(be)ce", "ah(ah)ce"); /// let changes: Vec<_> = diff @@ -256,7 +256,7 @@ impl TextDiffConfig { /// which lets you remap the diffs back to the original input strings. /// /// ```rust - /// use similar::{TextDiff, ChangeTag}; + /// use likewise::{TextDiff, ChangeTag}; /// /// let diff = TextDiff::configure().diff_graphemes("πŸ’©πŸ‡¦πŸ‡ΉπŸ¦ ", "πŸ’©πŸ‡¦πŸ‡±β„οΈ"); /// let changes: Vec<_> = diff @@ -288,7 +288,7 @@ impl TextDiffConfig { /// Creates a diff of arbitrary slices. /// /// ```rust - /// use similar::{TextDiff, ChangeTag}; + /// use likewise::{TextDiff, ChangeTag}; /// /// let old = &["foo", "bar", "baz"]; /// let new = &["foo", "BAR", "baz"]; @@ -469,7 +469,7 @@ impl<'old, 'new, 'bufs, T: DiffableStr + ?Sized + 'old + 'new> TextDiff<'old, 'n /// ratio of `0.0` would indicate completely distinct sequences. /// /// ```rust - /// # use similar::TextDiff; + /// # use likewise::TextDiff; /// let diff = TextDiff::from_chars("abcd", "bcde"); /// assert_eq!(diff.ratio(), 0.75); /// ``` @@ -575,7 +575,7 @@ impl<'old, 'new, 'bufs, T: DiffableStr + ?Sized + 'old + 'new> TextDiff<'old, 'n /// to be considered similar. See [`TextDiff::ratio`] for more information. /// /// ``` -/// # use similar::get_close_matches; +/// # use likewise::get_close_matches; /// let matches = get_close_matches( /// "appel", /// &["ape", "apple", "peach", "puppy"][..], diff --git a/src/text/snapshots/similar__text__captured_ops.snap b/src/text/snapshots/likewise__text__captured_ops.snap similarity index 100% rename from src/text/snapshots/similar__text__captured_ops.snap rename to src/text/snapshots/likewise__text__captured_ops.snap diff --git a/src/text/snapshots/similar__text__captured_word_ops.snap b/src/text/snapshots/likewise__text__captured_word_ops.snap similarity index 100% rename from src/text/snapshots/similar__text__captured_word_ops.snap rename to src/text/snapshots/likewise__text__captured_word_ops.snap diff --git a/src/text/snapshots/similar__text__char_diff.snap b/src/text/snapshots/likewise__text__char_diff.snap similarity index 100% rename from src/text/snapshots/similar__text__char_diff.snap rename to src/text/snapshots/likewise__text__char_diff.snap diff --git a/src/text/snapshots/similar__text__lifetimes_on_iter.snap b/src/text/snapshots/likewise__text__lifetimes_on_iter.snap similarity index 100% rename from src/text/snapshots/similar__text__lifetimes_on_iter.snap rename to src/text/snapshots/likewise__text__lifetimes_on_iter.snap diff --git a/src/text/snapshots/similar__text__line_ops.snap b/src/text/snapshots/likewise__text__line_ops.snap similarity index 100% rename from src/text/snapshots/similar__text__line_ops.snap rename to src/text/snapshots/likewise__text__line_ops.snap diff --git a/src/text/snapshots/similar__text__unified_diff.snap b/src/text/snapshots/likewise__text__unified_diff.snap similarity index 99% rename from src/text/snapshots/similar__text__unified_diff.snap rename to src/text/snapshots/likewise__text__unified_diff.snap index 77f409a..acee570 100644 --- a/src/text/snapshots/similar__text__unified_diff.snap +++ b/src/text/snapshots/likewise__text__unified_diff.snap @@ -9,4 +9,3 @@ expression: "&diff.unified_diff().context_radius(3).header(\"old\", \"new\").to_ -some stuff here +some amazing stuff here some more stuff here - diff --git a/src/text/snapshots/similar__text__virtual_newlines.snap b/src/text/snapshots/likewise__text__virtual_newlines.snap similarity index 100% rename from src/text/snapshots/similar__text__virtual_newlines.snap rename to src/text/snapshots/likewise__text__virtual_newlines.snap diff --git a/src/text/snapshots/similar__text__inline__line_ops_inline.snap b/src/text/snapshots/similar__text__inline__line_ops_inline.snap deleted file mode 100644 index 2133460..0000000 --- a/src/text/snapshots/similar__text__inline__line_ops_inline.snap +++ /dev/null @@ -1,126 +0,0 @@ ---- -source: src/text/inline.rs -expression: "&changes" ---- -[ - InlineChange { - tag: Insert, - old_index: None, - new_index: Some( - 0, - ), - values: [ - ( - false, - "Stuff\n", - ), - ], - }, - InlineChange { - tag: Equal, - old_index: Some( - 0, - ), - new_index: Some( - 1, - ), - values: [ - ( - false, - "Hello World\n", - ), - ], - }, - InlineChange { - tag: Delete, - old_index: Some( - 1, - ), - new_index: None, - values: [ - ( - false, - "some ", - ), - ( - false, - "stuff here\n", - ), - ], - }, - InlineChange { - tag: Insert, - old_index: None, - new_index: Some( - 2, - ), - values: [ - ( - false, - "some ", - ), - ( - true, - "amazing ", - ), - ( - false, - "stuff here\n", - ), - ], - }, - InlineChange { - tag: Equal, - old_index: Some( - 2, - ), - new_index: Some( - 3, - ), - values: [ - ( - false, - "some more stuff here\n", - ), - ], - }, - InlineChange { - tag: Delete, - old_index: Some( - 3, - ), - new_index: None, - values: [ - ( - false, - "\n", - ), - ], - }, - InlineChange { - tag: Delete, - old_index: Some( - 4, - ), - new_index: None, - values: [ - ( - false, - "Aha stuff here\n", - ), - ], - }, - InlineChange { - tag: Delete, - old_index: Some( - 5, - ), - new_index: None, - values: [ - ( - false, - "and more stuff", - ), - ], - }, -] diff --git a/src/text/snapshots/similar__text__inline__serde.snap b/src/text/snapshots/similar__text__inline__serde.snap deleted file mode 100644 index 44ab829..0000000 --- a/src/text/snapshots/similar__text__inline__serde.snap +++ /dev/null @@ -1,107 +0,0 @@ ---- -source: src/text/inline.rs -expression: "&json" - ---- -[ - { - "tag": "insert", - "old_index": null, - "new_index": 0, - "values": [ - [ - false, - "Stuff\n" - ] - ] - }, - { - "tag": "equal", - "old_index": 0, - "new_index": 1, - "values": [ - [ - false, - "Hello World\n" - ] - ] - }, - { - "tag": "delete", - "old_index": 1, - "new_index": null, - "values": [ - [ - false, - "some " - ], - [ - false, - "stuff here\n" - ] - ] - }, - { - "tag": "insert", - "old_index": null, - "new_index": 2, - "values": [ - [ - false, - "some " - ], - [ - true, - "amazing " - ], - [ - false, - "stuff here\n" - ] - ] - }, - { - "tag": "equal", - "old_index": 2, - "new_index": 3, - "values": [ - [ - false, - "some more stuff here\n" - ] - ] - }, - { - "tag": "delete", - "old_index": 3, - "new_index": null, - "values": [ - [ - false, - "\n" - ] - ] - }, - { - "tag": "delete", - "old_index": 4, - "new_index": null, - "values": [ - [ - false, - "Aha stuff here\n" - ] - ] - }, - { - "tag": "delete", - "old_index": 5, - "new_index": null, - "values": [ - [ - false, - "and more stuff" - ] - ] - } -] diff --git a/src/text/snapshots/similar__text__serde.snap b/src/text/snapshots/similar__text__serde.snap deleted file mode 100644 index 13418a6..0000000 --- a/src/text/snapshots/similar__text__serde.snap +++ /dev/null @@ -1,55 +0,0 @@ ---- -source: src/text/mod.rs -expression: "&json" - ---- -[ - { - "tag": "insert", - "old_index": null, - "new_index": 0, - "value": "Stuff\n" - }, - { - "tag": "equal", - "old_index": 0, - "new_index": 1, - "value": "Hello World\n" - }, - { - "tag": "delete", - "old_index": 1, - "new_index": null, - "value": "some stuff here\n" - }, - { - "tag": "insert", - "old_index": null, - "new_index": 2, - "value": "some amazing stuff here\n" - }, - { - "tag": "equal", - "old_index": 2, - "new_index": 3, - "value": "some more stuff here\n" - }, - { - "tag": "delete", - "old_index": 3, - "new_index": null, - "value": "\n" - }, - { - "tag": "delete", - "old_index": 4, - "new_index": null, - "value": "Aha stuff here\n" - }, - { - "tag": "delete", - "old_index": 5, - "new_index": null, - "value": "and more stuff" - } -] diff --git a/src/text/snapshots/similar__text__serde_ops.snap b/src/text/snapshots/similar__text__serde_ops.snap deleted file mode 100644 index 040fe97..0000000 --- a/src/text/snapshots/similar__text__serde_ops.snap +++ /dev/null @@ -1,38 +0,0 @@ ---- -source: src/text/mod.rs -expression: "&json" - ---- -[ - { - "op": "insert", - "old_index": 0, - "new_index": 0, - "new_len": 1 - }, - { - "op": "equal", - "old_index": 0, - "new_index": 1, - "len": 1 - }, - { - "op": "replace", - "old_index": 1, - "old_len": 1, - "new_index": 2, - "new_len": 1 - }, - { - "op": "equal", - "old_index": 2, - "new_index": 3, - "len": 1 - }, - { - "op": "delete", - "old_index": 3, - "old_len": 3, - "new_index": 4 - } -] diff --git a/src/types.rs b/src/types.rs index 4399a68..4a5c8b9 100644 --- a/src/types.rs +++ b/src/types.rs @@ -284,8 +284,8 @@ impl DiffOp { /// the diffing algorithm functions. /// /// ```rust - /// use similar::{ChangeTag, Algorithm}; - /// use similar::capture_diff_slices; + /// use likewise::{ChangeTag, Algorithm}; + /// use likewise::capture_diff_slices; /// let old = vec!["foo", "bar", "baz"]; /// let new = vec!["foo", "bar", "blah"]; /// let ops = capture_diff_slices(Algorithm::Myers, &old, &new); @@ -322,8 +322,8 @@ impl DiffOp { /// [`DiffOp::Replace`] operation is passed. /// /// ```rust - /// use similar::{ChangeTag, Algorithm}; - /// use similar::capture_diff_slices; + /// use likewise::{ChangeTag, Algorithm}; + /// use likewise::capture_diff_slices; /// let old = vec!["foo", "bar", "baz"]; /// let new = vec!["foo", "bar", "blah"]; /// let ops = capture_diff_slices(Algorithm::Myers, &old, &new); diff --git a/src/udiff.rs b/src/udiff.rs index 26701da..f7de91d 100644 --- a/src/udiff.rs +++ b/src/udiff.rs @@ -4,7 +4,7 @@ //! is enabled by default: //! //! ```rust -//! use similar::TextDiff; +//! use likewise::TextDiff; //! # let old_text = ""; //! # let new_text = ""; //! let text_diff = TextDiff::from_lines(old_text, new_text); @@ -101,7 +101,7 @@ impl fmt::Display for UnifiedHunkHeader { /// Unified diff formatter. /// /// ```rust -/// use similar::TextDiff; +/// use likewise::TextDiff; /// # let old_text = ""; /// # let new_text = ""; /// let text_diff = TextDiff::from_lines(old_text, new_text); diff --git a/src/utils.rs b/src/utils.rs index 7b2cdb3..8b68753 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -76,8 +76,8 @@ impl Index> for SliceRemapper<'_, T> { /// but large consequitive ones from the source. /// /// ```rust -/// use similar::{ChangeTag, TextDiff}; -/// use similar::utils::TextDiffRemapper; +/// use likewise::{ChangeTag, TextDiff}; +/// use likewise::utils::TextDiffRemapper; /// /// let old = "yo! foo bar baz"; /// let new = "yo! foo bor baz"; @@ -198,8 +198,8 @@ impl<'x, T: DiffableStr + ?Sized> TextDiffRemapper<'x, T> { /// with the changes. /// /// ```rust -/// use similar::{Algorithm, ChangeTag}; -/// use similar::utils::diff_slices; +/// use likewise::{Algorithm, ChangeTag}; +/// use likewise::utils::diff_slices; /// /// let old = "foo\nbar\nbaz".lines().collect::>(); /// let new = "foo\nbar\nBAZ".lines().collect::>(); @@ -227,8 +227,8 @@ pub fn diff_slices<'x, T: PartialEq + Hash + Ord>( /// rather than character level slices. /// /// ```rust -/// use similar::{Algorithm, ChangeTag}; -/// use similar::utils::diff_chars; +/// use likewise::{Algorithm, ChangeTag}; +/// use likewise::utils::diff_chars; /// /// assert_eq!(diff_chars(Algorithm::Myers, "foobarbaz", "fooBARbaz"), vec![ /// (ChangeTag::Equal, "foo"), @@ -259,8 +259,8 @@ pub fn diff_chars<'x, T: DiffableStrRef + ?Sized>( /// rather than word level slices. /// /// ```rust -/// use similar::{Algorithm, ChangeTag}; -/// use similar::utils::diff_words; +/// use likewise::{Algorithm, ChangeTag}; +/// use likewise::utils::diff_words; /// /// assert_eq!(diff_words(Algorithm::Myers, "foo bar baz", "foo bor baz"), vec![ /// (ChangeTag::Equal, "foo "), @@ -291,8 +291,8 @@ pub fn diff_words<'x, T: DiffableStrRef + ?Sized>( /// rather than word level slices. /// /// ```rust -/// use similar::{Algorithm, ChangeTag}; -/// use similar::utils::diff_unicode_words; +/// use likewise::{Algorithm, ChangeTag}; +/// use likewise::utils::diff_unicode_words; /// /// let old = "The quick (\"brown\") fox can't jump 32.3 feet, right?"; /// let new = "The quick (\"brown\") fox can't jump 9.84 meters, right?"; @@ -333,8 +333,8 @@ pub fn diff_unicode_words<'x, T: DiffableStrRef + ?Sized>( /// rather than grapheme level slices. /// /// ```rust -/// use similar::{Algorithm, ChangeTag}; -/// use similar::utils::diff_graphemes; +/// use likewise::{Algorithm, ChangeTag}; +/// use likewise::utils::diff_graphemes; /// /// let old = "The flag of Austria is πŸ‡¦πŸ‡Ή"; /// let new = "The flag of Albania is πŸ‡¦πŸ‡±"; @@ -374,8 +374,8 @@ pub fn diff_graphemes<'x, T: DiffableStrRef + ?Sized>( /// change tag for each line. /// /// ```rust -/// use similar::{Algorithm, ChangeTag}; -/// use similar::utils::diff_lines; +/// use likewise::{Algorithm, ChangeTag}; +/// use likewise::utils::diff_lines; /// /// assert_eq!(diff_lines(Algorithm::Myers, "foo\nbar\nbaz\nblah", "foo\nbar\nbaz\nblurgh"), vec![ /// (ChangeTag::Equal, "foo\n"),