| 1 | use regexrust-analyzer cargo regex 1.12.3 crate/::Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex#; |
| 2 | |
| 3 | use unicode_segmentationrust-analyzer cargo unicode-segmentation 1.12.0 crate/::UnicodeSegmentationrust-analyzer cargo unicode-segmentation 1.12.0 UnicodeSegmentation#; |
| 4 | use unicode_widthrust-analyzer cargo unicode-width 0.1.14 crate/::UnicodeWidthStrrust-analyzer cargo unicode-width 0.1.14 UnicodeWidthStr#; |
| 5 | |
| 6 | use craterust-analyzer cargo git-delta 0.19.2 crate/::alignrust-analyzer cargo git-delta 0.19.2 align/; |
| 7 | use craterust-analyzer cargo git-delta 0.19.2 crate/::minusplusrust-analyzer cargo git-delta 0.19.2 minusplus/::MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#; |
| 8 | |
| 9 | /// Infer the edit operations responsible for the differences between a collection of old and new |
| 10 | /// lines. A "line" is a string. An annotated line is a Vec of (op, &str) pairs, where the &str |
| 11 | /// slices are slices of the line, and their concatenation equals the line. Return the input minus |
| 12 | /// and plus lines, in annotated form. |
| 13 | /// |
| 14 | /// Also return a specification of the inferred alignment of minus and plus lines: a paired minus |
| 15 | /// and plus line is represented in this alignment specification as |
| 16 | /// (Some(minus_line_index),Some(plus_line_index)), whereas an unpaired minus line is |
| 17 | /// (Some(minus_line_index), None). |
| 18 | /// |
| 19 | /// `noop_deletions[i]` is the appropriate deletion operation tag to be used for `minus_lines[i]`; |
| 20 | /// `noop_deletions` is guaranteed to be the same length as `minus_lines`. The equivalent statements |
| 21 | /// hold for `plus_insertions` and `plus_lines`. |
| 22 | #[allow(clippy::too_many_arguments)] |
| 23 | #[allow(clippy::type_complexity)] |
| 24 | pub fn infer_editsrust-analyzer cargo git-delta 0.19.2 edits/infer_edits().<'a, EditOperation>( |
| 25 | minus_lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&'a str>, |
| 26 | plus_lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&'a str>, |
| 27 | noop_deletions: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<EditOperation>, |
| 28 | deletion: EditOperation, |
| 29 | noop_insertions: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<EditOperation>, |
| 30 | insertion: EditOperation, |
| 31 | tokenization_regex: &Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex#, |
| 32 | max_line_distance: f64, |
| 33 | max_line_distance_for_naively_paired_lines: f64, |
| 34 | ) -> ( |
| 35 | Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(EditOperation, &'a str)>>, // annotated minus lines |
| 36 | Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(EditOperation, &'a str)>>, // annotated plus lines |
| 37 | Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>)>, // line alignment |
| 38 | ) |
| 39 | where |
| 40 | EditOperation: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 41 | { |
| 42 | let mut annotated_minus_lines = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(EditOperation, &str)>>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 43 | let mut annotated_plus_lines = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(EditOperation, &str)>>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 44 | let mut line_alignment = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::<(Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>)>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 45 | |
| 46 | let mut plus_index = 0; // plus lines emitted so far |
| 47 | |
| 48 | 'minus_lines_loop: for (minus_index, minus_line) in minus_lines.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 49 | let mut considered = 0; // plus lines considered so far as match for minus_line |
| 50 | for plus_line in &plus_lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().plus_index..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). { |
| 51 | let alignment = alignrust-analyzer cargo git-delta 0.19.2 align/::Alignmentrust-analyzer cargo git-delta 0.19.2 align/Alignment#::newrust-analyzer cargo git-delta 0.19.2 align/impl#[`Alignment<'a>`]new().( |
| 52 | tokenizerust-analyzer cargo git-delta 0.19.2 edits/tokenize().(minus_line, tokenization_regex), |
| 53 | tokenizerust-analyzer cargo git-delta 0.19.2 edits/tokenize().(plus_line, tokenization_regex), |
| 54 | ); |
| 55 | let (annotated_minus_line, annotated_plus_line, distance) = annotaterust-analyzer cargo git-delta 0.19.2 edits/annotate().( |
| 56 | alignment, |
| 57 | noop_deletions[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().minus_index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., |
| 58 | deletion, |
| 59 | noop_insertions[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().plus_index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., |
| 60 | insertion, |
| 61 | minus_line, |
| 62 | plus_line, |
| 63 | ); |
| 64 | if minus_lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().plus_lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() |
| 65 | && distance rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().max_line_distance_for_naively_paired_lines |
| 66 | || distance rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]le().max_line_distance |
| 67 | { |
| 68 | // minus_line and plus_line are inferred to be a homologous pair. |
| 69 | |
| 70 | // Emit as unpaired the plus lines already considered and rejected |
| 71 | for plus_line in &plus_lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().plus_index..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#(plus_index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().considered)]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). { |
| 72 | annotated_plus_lines.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(noop_insertions[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().plus_index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., plus_line)]); |
| 73 | line_alignment.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(plus_index))); |
| 74 | plus_index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 75 | } |
| 76 | annotated_minus_lines.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(annotated_minus_line); |
| 77 | annotated_plus_lines.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(annotated_plus_line); |
| 78 | line_alignment.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(minus_index), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(plus_index))); |
| 79 | plus_index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 80 | |
| 81 | // Greedy: move on to the next minus line. |
| 82 | continue 'minus_lines_loop; |
| 83 | } else { |
| 84 | considered rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 85 | } |
| 86 | } |
| 87 | // No homolog was found for minus i; emit as unpaired. |
| 88 | annotated_minus_lines.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(noop_deletions[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().minus_index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., minus_line)]); |
| 89 | line_alignment.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(minus_index), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)); |
| 90 | } |
| 91 | // Emit any remaining plus lines |
| 92 | for plus_line in &plus_lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().plus_index..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). { |
| 93 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(content) = get_contents_before_trailing_whitespacerust-analyzer cargo git-delta 0.19.2 edits/get_contents_before_trailing_whitespace().(plus_line) { |
| 94 | annotated_plus_lines.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 95 | (noop_insertions[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().plus_index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., content), |
| 96 | (noop_insertions[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().plus_index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., &plus_line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().content.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()..]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().), |
| 97 | ]); |
| 98 | } else { |
| 99 | annotated_plus_lines.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(noop_insertions[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().plus_index]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., plus_line)]); |
| 100 | } |
| 101 | line_alignment.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(plus_index))); |
| 102 | plus_index rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 103 | } |
| 104 | |
| 105 | (annotated_minus_lines, annotated_plus_lines, line_alignment) |
| 106 | } |
| 107 | |
| 108 | // Return `None` if there is no trailing whitespace. |
| 109 | // Return `Some(content)` where content is trimmed if there was some trailing whitespace |
| 110 | fn get_contents_before_trailing_whitespacerust-analyzer cargo git-delta 0.19.2 edits/get_contents_before_trailing_whitespace().(line: &str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str> { |
| 111 | let content = line.trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().(); |
| 112 | // if line has a trailing newline, do not consider it as a 'trailing whitespace' |
| 113 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().content.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() && content rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().line.trim_end_matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end_matches().('\n') { |
| 114 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(content) |
| 115 | } else { |
| 116 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | // Return boolean arrays indicating whether each line has a homolog (is "paired"). |
| 121 | pub fn make_lines_have_homologrust-analyzer cargo git-delta 0.19.2 edits/make_lines_have_homolog().( |
| 122 | line_alignment: &[(Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>)], |
| 123 | ) -> MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<bool>> { |
| 124 | MinusPlusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlus#::newrust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`]new().( |
| 125 | line_alignment |
| 126 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 127 | .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|(m, _)| m.is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()) |
| 128 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(_, p)| p.is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()) |
| 129 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 130 | line_alignment |
| 131 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 132 | .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|(_, p)| p.is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()) |
| 133 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(m, _)| m.is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()) |
| 134 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 135 | ) |
| 136 | } |
| 137 | |
| 138 | /// Split line into tokens for alignment. The alignment algorithm aligns sequences of substrings; |
| 139 | /// not individual characters. |
| 140 | fn tokenizerust-analyzer cargo git-delta 0.19.2 edits/tokenize().<'a>(line: &'a str, regex: &Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex#) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&'a str> { |
| 141 | // Starting with "", see comment in Alignment::new(). Historical note: Replacing the '+/-' |
| 142 | // prefix with a space implicitly generated this. |
| 143 | let mut tokens = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![""]; |
| 144 | let mut offset = 0; |
| 145 | for m in regex.find_iterrust-analyzer cargo regex 1.12.3 regex/string/impl#[Regex]find_iter().(line) { |
| 146 | if offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 && m.startrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Match<'h>`]start().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 { |
| 147 | tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(""); |
| 148 | } |
| 149 | // Align separating text as multiple single-character tokens. |
| 150 | for t in line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().offset..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#m.startrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Match<'h>`]start().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..graphemesrust-analyzer cargo unicode-segmentation 1.12.0 impl#[str][UnicodeSegmentation]graphemes().(true) { |
| 151 | tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(t); |
| 152 | } |
| 153 | tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(&line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().m.startrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Match<'h>`]start().()..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#m.endrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Match<'h>`]end().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 154 | offset = m.endrust-analyzer cargo regex 1.12.3 regex/string/impl#[`Match<'h>`]end().(); |
| 155 | } |
| 156 | if offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().line.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() { |
| 157 | if offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { |
| 158 | tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(""); |
| 159 | } |
| 160 | for t in line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().offset..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#line.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..graphemesrust-analyzer cargo unicode-segmentation 1.12.0 impl#[str][UnicodeSegmentation]graphemes().(true) { |
| 161 | tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(t); |
| 162 | } |
| 163 | } |
| 164 | tokens |
| 165 | } |
| 166 | |
| 167 | /// Use alignment to "annotate" minus and plus lines. An "annotated" line is a sequence of |
| 168 | /// (a: Annotation, s: &str) pairs, where the &strs reference the memory |
| 169 | /// of the original line and their concatenation equals the line. |
| 170 | // This function doesn't return "coalesced" annotations: i.e. they're often are runs of consecutive |
| 171 | // occurrences of the same operation. Since it is returning &strs pointing into the memory of the |
| 172 | // original line, it's not possible to coalesce them in this function. |
| 173 | #[allow(clippy::type_complexity)] |
| 174 | fn annotaterust-analyzer cargo git-delta 0.19.2 edits/annotate().<'a, Annotation>( |
| 175 | alignment: alignrust-analyzer cargo git-delta 0.19.2 align/::Alignmentrust-analyzer cargo git-delta 0.19.2 align/Alignment#<'a>, |
| 176 | noop_deletion: Annotation, |
| 177 | deletion: Annotation, |
| 178 | noop_insertion: Annotation, |
| 179 | insertion: Annotation, |
| 180 | minus_line: &'a str, |
| 181 | plus_line: &'a str, |
| 182 | ) -> (Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Annotation, &'a str)>, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Annotation, &'a str)>, f64) |
| 183 | where |
| 184 | Annotation: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy# + PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# + stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 185 | { |
| 186 | let mut annotated_minus_line = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 187 | let mut annotated_plus_line = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 188 | |
| 189 | let (mut x_offset, mut y_offset) = (0, 0); |
| 190 | let (mut minus_line_offset, mut plus_line_offset) = (0, 0); |
| 191 | let (mut d_numer, mut d_denom) = (0, 0); |
| 192 | |
| 193 | // Note that the inputs to align::Alignment are not the original strings themselves, but |
| 194 | // sequences of substrings derived from the tokenization process. We have just applied |
| 195 | // run_length_encoding to "coalesce" runs of the same edit operation into a single |
| 196 | // operation. We now need to form a &str, pointing into the memory of the original line, |
| 197 | // identifying a "section" which is the concatenation of the substrings involved in this |
| 198 | // coalesced operation. That's what the following closures do. Note that they must be called |
| 199 | // once only since they advance offset pointers. |
| 200 | let get_section = |n: usize, |
| 201 | line_offset: &mut usize, |
| 202 | substrings_offset: &mut usize, |
| 203 | substrings: &[&str], |
| 204 | line: &'a str| { |
| 205 | let section_length = substrings[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().substrings_offset..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().substrings_offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().n]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). |
| 206 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 207 | .foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]fold().(0, |n, s| n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().s.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()); |
| 208 | let old_offset = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().line_offset; |
| 209 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().line_offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().section_length; |
| 210 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().substrings_offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().n; |
| 211 | &line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().old_offset..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().line_offset]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). |
| 212 | }; |
| 213 | let mut minus_section = |n: usize, offset: &mut usize| { |
| 214 | get_section(n, &mut minus_line_offset, offset, &alignment.xrust-analyzer cargo git-delta 0.19.2 align/Alignment#x., minus_line) |
| 215 | }; |
| 216 | let mut plus_section = |n: usize, offset: &mut usize| { |
| 217 | get_section(n, &mut plus_line_offset, offset, &alignment.yrust-analyzer cargo git-delta 0.19.2 align/Alignment#y., plus_line) |
| 218 | }; |
| 219 | let distance_contribution = |section: &str| UnicodeWidthStrrust-analyzer cargo unicode-width 0.1.14 UnicodeWidthStr#::widthrust-analyzer cargo unicode-width 0.1.14 impl#[str][UnicodeWidthStr]width().(section.trimrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim().()); |
| 220 | |
| 221 | let (mut minus_op_prev, mut plus_op_prev) = (noop_deletion, noop_insertion); |
| 222 | for (op, n) in alignment.coalesced_operationsrust-analyzer cargo git-delta 0.19.2 align/impl#[`Alignment<'a>`]coalesced_operations().() { |
| 223 | match op { |
| 224 | alignrust-analyzer cargo git-delta 0.19.2 align/::Operationrust-analyzer cargo git-delta 0.19.2 align/Operation#::Deletionrust-analyzer cargo git-delta 0.19.2 align/Operation#Deletion# => { |
| 225 | let minus_section = minus_section(n, &mut x_offset); |
| 226 | let n_d = distance_contribution(minus_section); |
| 227 | d_denom rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().n_d; |
| 228 | d_numer rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().n_d; |
| 229 | annotated_minus_line.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((deletion, minus_section)); |
| 230 | minus_op_prev = deletion; |
| 231 | } |
| 232 | alignrust-analyzer cargo git-delta 0.19.2 align/::Operationrust-analyzer cargo git-delta 0.19.2 align/Operation#::NoOprust-analyzer cargo git-delta 0.19.2 align/Operation#NoOp# => { |
| 233 | let minus_section = minus_section(n, &mut x_offset); |
| 234 | let n_d = distance_contribution(minus_section); |
| 235 | d_denom rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().n_d; |
| 236 | let is_space = minus_section.trimrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().(); |
| 237 | let coalesce_space_with_previous = is_space |
| 238 | && ((minus_op_prev rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().deletion |
| 239 | && plus_op_prev rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().insertion |
| 240 | && (x_offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().alignment.xrust-analyzer cargo git-delta 0.19.2 align/Alignment#x..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1 || y_offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().alignment.yrust-analyzer cargo git-delta 0.19.2 align/Alignment#y..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1)) |
| 241 | || (minus_op_prev rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().noop_deletion && plus_op_prev rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().noop_insertion)); |
| 242 | annotated_minus_line.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(( |
| 243 | if coalesce_space_with_previous { |
| 244 | minus_op_prev |
| 245 | } else { |
| 246 | noop_deletion |
| 247 | }, |
| 248 | minus_section, |
| 249 | )); |
| 250 | let op = if coalesce_space_with_previous { |
| 251 | plus_op_prev |
| 252 | } else { |
| 253 | noop_insertion |
| 254 | }; |
| 255 | let plus_section = plus_section(n, &mut y_offset); |
| 256 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(non_whitespace) = get_contents_before_trailing_whitespacerust-analyzer cargo git-delta 0.19.2 edits/get_contents_before_trailing_whitespace().(plus_section) |
| 257 | { |
| 258 | annotated_plus_line.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((op, non_whitespace)); |
| 259 | annotated_plus_line.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((op, &plus_section[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().non_whitespace.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().)); |
| 260 | } else { |
| 261 | annotated_plus_line.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((op, plus_section)); |
| 262 | } |
| 263 | minus_op_prev = noop_deletion; |
| 264 | plus_op_prev = noop_insertion; |
| 265 | } |
| 266 | alignrust-analyzer cargo git-delta 0.19.2 align/::Operationrust-analyzer cargo git-delta 0.19.2 align/Operation#::Insertionrust-analyzer cargo git-delta 0.19.2 align/Operation#Insertion# => { |
| 267 | let plus_section = plus_section(n, &mut y_offset); |
| 268 | let n_d = distance_contribution(plus_section); |
| 269 | d_denom rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().n_d; |
| 270 | d_numer rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().n_d; |
| 271 | annotated_plus_line.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((insertion, plus_section)); |
| 272 | plus_op_prev = insertion; |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | ( |
| 277 | annotated_minus_line, |
| 278 | annotated_plus_line, |
| 279 | compute_distancerust-analyzer cargo git-delta 0.19.2 edits/compute_distance().(d_numer as f64, d_denom as f64), |
| 280 | ) |
| 281 | } |
| 282 | |
| 283 | fn compute_distancerust-analyzer cargo git-delta 0.19.2 edits/compute_distance().(d_numer: f64, d_denom: f64) -> f64 { |
| 284 | if d_denom rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]gt().0.0 { |
| 285 | d_numer rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().d_denom |
| 286 | } else { |
| 287 | 0.0 |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | #[cfg(test)] |
| 292 | mod testsrust-analyzer cargo git-delta 0.19.2 edits/tests/ { |
| 293 | use superrust-analyzer cargo git-delta 0.19.2 edits/::*; |
| 294 | use itertoolsrust-analyzer cargo itertools 0.14.0 crate/::Itertoolsrust-analyzer cargo itertools 0.14.0 Itertools#; |
| 295 | use lazy_staticrust-analyzer cargo lazy_static 1.4.0 crate/::lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!; |
| 296 | use unicode_segmentationrust-analyzer cargo unicode-segmentation 1.12.0 crate/::UnicodeSegmentationrust-analyzer cargo unicode-segmentation 1.12.0 UnicodeSegmentation#; |
| 297 | |
| 298 | lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!! { |
| 299 | static ref DEFAULT_TOKENIZATION_REGEXPrust-analyzer cargo git-delta 0.19.2 edits/tests/DEFAULT_TOKENIZATION_REGEXP#: Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex# = Regexrust-analyzer cargo regex 1.12.3 regex/string/Regex#::newrust-analyzer cargo regex 1.12.3 regex/string/impl#[Regex]new().(r#"\w+"#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 300 | } |
| 301 | |
| 302 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 303 | enum EditOperationrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation# { |
| 304 | MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, |
| 305 | PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, |
| 306 | Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, |
| 307 | Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, |
| 308 | } |
| 309 | |
| 310 | type Annotationrust-analyzer cargo git-delta 0.19.2 edits/tests/Annotation#<'a> = (EditOperationrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#, &'a str); |
| 311 | type AnnotatedLinerust-analyzer cargo git-delta 0.19.2 edits/tests/AnnotatedLine#<'a> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Annotationrust-analyzer cargo git-delta 0.19.2 edits/tests/Annotation#<'a>>; |
| 312 | type AnnotatedLinesrust-analyzer cargo git-delta 0.19.2 edits/tests/AnnotatedLines#<'a> = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<AnnotatedLinerust-analyzer cargo git-delta 0.19.2 edits/tests/AnnotatedLine#<'a>>; |
| 313 | type Editsrust-analyzer cargo git-delta 0.19.2 edits/tests/Edits#<'a> = (AnnotatedLinesrust-analyzer cargo git-delta 0.19.2 edits/tests/AnnotatedLines#<'a>, AnnotatedLinesrust-analyzer cargo git-delta 0.19.2 edits/tests/AnnotatedLines#<'a>); |
| 314 | |
| 315 | use EditOperationrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#::*; |
| 316 | |
| 317 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 318 | fn test_tokenize_0rust-analyzer cargo git-delta 0.19.2 edits/tests/test_tokenize_0().() { |
| 319 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().("", &[]); |
| 320 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().(";", &["", ";"]); |
| 321 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().(";;", &["", ";", ";"]); |
| 322 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().(";;a", &["", ";", ";", "a"]); |
| 323 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().(";;ab", &["", ";", ";", "ab"]); |
| 324 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().(";;ab;", &["", ";", ";", "ab", ";"]); |
| 325 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().(";;ab;;", &["", ";", ";", "ab", ";", ";"]); |
| 326 | } |
| 327 | |
| 328 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 329 | fn test_tokenize_1rust-analyzer cargo git-delta 0.19.2 edits/tests/test_tokenize_1().() { |
| 330 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().("aaa bbb", &["aaa", " ", "bbb"]) |
| 331 | } |
| 332 | |
| 333 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 334 | fn test_tokenize_2rust-analyzer cargo git-delta 0.19.2 edits/tests/test_tokenize_2().() { |
| 335 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().( |
| 336 | "fn coalesce_edits<'a, EditOperation>(", |
| 337 | &[ |
| 338 | "fn", |
| 339 | " ", |
| 340 | "coalesce_edits", |
| 341 | "<", |
| 342 | "'", |
| 343 | "a", |
| 344 | ",", |
| 345 | " ", |
| 346 | "EditOperation", |
| 347 | ">", |
| 348 | "(", |
| 349 | ], |
| 350 | ); |
| 351 | } |
| 352 | |
| 353 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 354 | fn test_tokenize_3rust-analyzer cargo git-delta 0.19.2 edits/tests/test_tokenize_3().() { |
| 355 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().( |
| 356 | "fn coalesce_edits<'a, 'b, EditOperation>(", |
| 357 | &[ |
| 358 | "fn", |
| 359 | " ", |
| 360 | "coalesce_edits", |
| 361 | "<", |
| 362 | "'", |
| 363 | "a", |
| 364 | ",", |
| 365 | " ", |
| 366 | "'", |
| 367 | "b", |
| 368 | ",", |
| 369 | " ", |
| 370 | "EditOperation", |
| 371 | ">", |
| 372 | "(", |
| 373 | ], |
| 374 | ); |
| 375 | } |
| 376 | |
| 377 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 378 | fn test_tokenize_4rust-analyzer cargo git-delta 0.19.2 edits/tests/test_tokenize_4().() { |
| 379 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().( |
| 380 | "annotated_plus_lines.push(vec![(noop_insertion, plus_line)]);", |
| 381 | &[ |
| 382 | "annotated_plus_lines", |
| 383 | ".", |
| 384 | "push", |
| 385 | "(", |
| 386 | "vec", |
| 387 | "!", |
| 388 | "[", |
| 389 | "(", |
| 390 | "noop_insertion", |
| 391 | ",", |
| 392 | " ", |
| 393 | "plus_line", |
| 394 | ")", |
| 395 | "]", |
| 396 | ")", |
| 397 | ";", |
| 398 | ], |
| 399 | ); |
| 400 | } |
| 401 | |
| 402 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 403 | fn test_tokenize_5rust-analyzer cargo git-delta 0.19.2 edits/tests/test_tokenize_5().() { |
| 404 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().( |
| 405 | " let col = Color::from_str(s).unwrap_or_else(|_| die());", |
| 406 | &[ |
| 407 | "", |
| 408 | " ", |
| 409 | " ", |
| 410 | " ", |
| 411 | " ", |
| 412 | " ", |
| 413 | " ", |
| 414 | " ", |
| 415 | " ", |
| 416 | " ", |
| 417 | "let", |
| 418 | " ", |
| 419 | "col", |
| 420 | " ", |
| 421 | "=", |
| 422 | " ", |
| 423 | "Color", |
| 424 | ":", |
| 425 | ":", |
| 426 | "from_str", |
| 427 | "(", |
| 428 | "s", |
| 429 | ")", |
| 430 | ".", |
| 431 | "unwrap_or_else", |
| 432 | "(", |
| 433 | "|", |
| 434 | "_", |
| 435 | "|", |
| 436 | " ", |
| 437 | "die", |
| 438 | "(", |
| 439 | ")", |
| 440 | ")", |
| 441 | ";", |
| 442 | ], |
| 443 | ) |
| 444 | } |
| 445 | |
| 446 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 447 | fn test_tokenize_6rust-analyzer cargo git-delta 0.19.2 edits/tests/test_tokenize_6().() { |
| 448 | assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().( |
| 449 | " (minus_file, plus_file) => format!(\"renamed: {} ⟶ {}\", minus_file, plus_file),", |
| 450 | &["", |
| 451 | " ", |
| 452 | " ", |
| 453 | " ", |
| 454 | " ", |
| 455 | " ", |
| 456 | " ", |
| 457 | " ", |
| 458 | " ", |
| 459 | " ", |
| 460 | "(", |
| 461 | "minus_file", |
| 462 | ",", |
| 463 | " ", |
| 464 | "plus_file", |
| 465 | ")", |
| 466 | " ", |
| 467 | "=", |
| 468 | ">", |
| 469 | " ", |
| 470 | "format", |
| 471 | "!", |
| 472 | "(", |
| 473 | "\"", |
| 474 | "renamed", |
| 475 | ":", |
| 476 | " ", |
| 477 | "{", |
| 478 | "}", |
| 479 | " ", |
| 480 | "⟶", |
| 481 | " ", |
| 482 | " ", |
| 483 | "{", |
| 484 | "}", |
| 485 | "\"", |
| 486 | ",", |
| 487 | " ", |
| 488 | "minus_file", |
| 489 | ",", |
| 490 | " ", |
| 491 | "plus_file", |
| 492 | ")", |
| 493 | ","]) |
| 494 | } |
| 495 | |
| 496 | fn assert_tokenizerust-analyzer cargo git-delta 0.19.2 edits/tests/assert_tokenize().(text: &str, expected_tokens: &[&str]) { |
| 497 | let actual_tokens = tokenizerust-analyzer cargo git-delta 0.19.2 edits/tokenize().(text, &DEFAULT_TOKENIZATION_REGEXPrust-analyzer cargo git-delta 0.19.2 edits/tests/DEFAULT_TOKENIZATION_REGEXP.); |
| 498 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(text, expected_tokens.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().joinrust-analyzer cargo itertools 0.14.0 Itertools#join().("")); |
| 499 | // tokenize() guarantees that the first element of the token stream is "". |
| 500 | // See comment in Alignment::new() |
| 501 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(actual_tokens[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., ""); |
| 502 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&actual_tokens[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1..]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., expected_tokens); |
| 503 | } |
| 504 | |
| 505 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 506 | fn test_infer_edits_1rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_1().() { |
| 507 | assert_paired_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_paired_edits().( |
| 508 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["aaa"], |
| 509 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["aba"], |
| 510 | ( |
| 511 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, ""), (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "aaa")]], |
| 512 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, ""), (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "aba")]], |
| 513 | ), |
| 514 | ) |
| 515 | } |
| 516 | |
| 517 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 518 | fn test_infer_edits_1_2rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_1_2().() { |
| 519 | assert_paired_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_paired_edits().( |
| 520 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["aaa ccc"], |
| 521 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["aba ccc"], |
| 522 | ( |
| 523 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 524 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, ""), |
| 525 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "aaa"), |
| 526 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, " ccc"), |
| 527 | ]], |
| 528 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, ""), (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "aba"), (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " ccc")]], |
| 529 | ), |
| 530 | ) |
| 531 | } |
| 532 | |
| 533 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 534 | fn test_infer_edits_2rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_2().() { |
| 535 | assert_paired_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_paired_edits().( |
| 536 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["áaa"], |
| 537 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["ááb"], |
| 538 | ( |
| 539 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, ""), (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "áaa")]], |
| 540 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, ""), (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "ááb")]], |
| 541 | ), |
| 542 | ) |
| 543 | } |
| 544 | |
| 545 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 546 | fn test_infer_edits_3rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_3().() { |
| 547 | assert_paired_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_paired_edits().( |
| 548 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["d.iteritems()"], |
| 549 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["d.items()"], |
| 550 | ( |
| 551 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 552 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "d."), |
| 553 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "iteritems"), |
| 554 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "()"), |
| 555 | ]], |
| 556 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 557 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "d."), |
| 558 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "items"), |
| 559 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "()"), |
| 560 | ]], |
| 561 | ), |
| 562 | ) |
| 563 | } |
| 564 | |
| 565 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 566 | fn test_infer_edits_4rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_4().() { |
| 567 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 568 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["á a a á a a á a a", "á á b á á b á á b"], |
| 569 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["á á b á á c á á b"], |
| 570 | ( |
| 571 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 572 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "á a a á a a á a a")], |
| 573 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 574 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "á á b á á "), |
| 575 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "b"), |
| 576 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, " á á b"), |
| 577 | ], |
| 578 | ], |
| 579 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 580 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "á á b á á"), |
| 581 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 582 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "c"), |
| 583 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " á á b"), |
| 584 | ]], |
| 585 | ), |
| 586 | 0.66, |
| 587 | ) |
| 588 | } |
| 589 | |
| 590 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 591 | fn test_infer_edits_5rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_5().() { |
| 592 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 593 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["aaaa a aaa", "bbbb b bbb", "cccc c ccc"], |
| 594 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["bbbb ! bbb", "dddd d ddd", "cccc ! ccc"], |
| 595 | ( |
| 596 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 597 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "aaaa a aaa")], |
| 598 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "bbbb "), (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "b"), (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, " bbb")], |
| 599 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "cccc "), (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "c"), (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, " ccc")], |
| 600 | ], |
| 601 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 602 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 603 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "bbbb"), |
| 604 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 605 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "!"), |
| 606 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " bbb"), |
| 607 | ], |
| 608 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "dddd d ddd")], |
| 609 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 610 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "cccc"), |
| 611 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 612 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "!"), |
| 613 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " ccc"), |
| 614 | ], |
| 615 | ], |
| 616 | ), |
| 617 | 0.66, |
| 618 | ) |
| 619 | } |
| 620 | |
| 621 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 622 | fn test_infer_edits_6rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_6().() { |
| 623 | assert_no_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_no_edits().( |
| 624 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 625 | " let mut i = 0;", |
| 626 | " for ((_, c0), (_, c1)) in s0.zip(s1) {", |
| 627 | " if c0 != c1 {", |
| 628 | " break;", |
| 629 | " } else {", |
| 630 | " i += c0.len();", |
| 631 | " }", |
| 632 | " }", |
| 633 | " i", |
| 634 | ], |
| 635 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 636 | " s0.zip(s1)", |
| 637 | " .take_while(|((_, c0), (_, c1))| c0 == c1) // TODO: Don't consume one-past-the-end!", |
| 638 | " .fold(0, |offset, ((_, c0), (_, _))| offset + c0.len())" |
| 639 | ], 0.5) |
| 640 | } |
| 641 | |
| 642 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 643 | fn test_infer_edits_7rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_7().() { |
| 644 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 645 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["fn coalesce_edits<'a, EditOperation>("], |
| 646 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["fn coalesce_edits<'a, 'b, EditOperation>("], |
| 647 | ( |
| 648 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 649 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "fn coalesce_edits<'a, "), |
| 650 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "EditOperation>("), |
| 651 | ]], |
| 652 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 653 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "fn coalesce_edits<'a,"), |
| 654 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 655 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "'b, "), |
| 656 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "EditOperation>("), |
| 657 | ]], |
| 658 | ), |
| 659 | 0.66, |
| 660 | ) |
| 661 | } |
| 662 | |
| 663 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 664 | fn test_infer_edits_8rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_8().() { |
| 665 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 666 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["for _ in range(0, options[\"count\"]):"], |
| 667 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["for _ in range(0, int(options[\"count\"])):"], |
| 668 | ( |
| 669 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 670 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "for _ in range(0, "), |
| 671 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "options[\"count\"])"), |
| 672 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, ":"), |
| 673 | ]], |
| 674 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 675 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "for _ in range(0,"), |
| 676 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 677 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "int("), |
| 678 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "options[\"count\"])"), |
| 679 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, ")"), |
| 680 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, ":"), |
| 681 | ]], |
| 682 | ), |
| 683 | 0.3, |
| 684 | ) |
| 685 | } |
| 686 | |
| 687 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 688 | fn test_infer_edits_9rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_9().() { |
| 689 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 690 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a a"], |
| 691 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a b a"], |
| 692 | ( |
| 693 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "a "), (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "a")]], |
| 694 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 695 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "a"), |
| 696 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 697 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "b "), |
| 698 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "a"), |
| 699 | ]], |
| 700 | ), |
| 701 | 1.0, |
| 702 | ); |
| 703 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 704 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a a"], |
| 705 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a b b a"], |
| 706 | ( |
| 707 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "a "), (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "a")]], |
| 708 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 709 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "a"), |
| 710 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 711 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "b b "), |
| 712 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "a"), |
| 713 | ]], |
| 714 | ), |
| 715 | 1.0, |
| 716 | ); |
| 717 | } |
| 718 | |
| 719 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 720 | fn test_infer_edits_10rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_10().() { |
| 721 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 722 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["so it is safe to read the commit number from any one of them."], |
| 723 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["so it is safe to read build info from any one of them."], |
| 724 | ( |
| 725 | // TODO: Coalesce runs of the same operation. |
| 726 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 727 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "so it is safe to read "), |
| 728 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "the commit"), |
| 729 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, " "), |
| 730 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "number"), |
| 731 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, " from any one of them."), |
| 732 | ]], |
| 733 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 734 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "so it is safe to read"), |
| 735 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 736 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "build"), |
| 737 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, " "), |
| 738 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "info"), |
| 739 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " from any one of them."), |
| 740 | ]], |
| 741 | ), |
| 742 | 1.0, |
| 743 | ); |
| 744 | } |
| 745 | |
| 746 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 747 | fn test_infer_edits_11rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_11().() { |
| 748 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 749 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![" self.table[index] ="], |
| 750 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![" self.table[index] = candidates"], |
| 751 | ( |
| 752 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, " self.table[index] =")]], |
| 753 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 754 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " self.table[index] ="), |
| 755 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, " candidates"), |
| 756 | ]], |
| 757 | ), |
| 758 | 1.0, |
| 759 | ); |
| 760 | } |
| 761 | |
| 762 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 763 | fn test_infer_edits_12rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_12().() { |
| 764 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 765 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![" (xxxxxxxxx, \"build info\"),"], |
| 766 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![" (xxxxxxxxx, \"build\"),"], |
| 767 | ( |
| 768 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 769 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, " (xxxxxxxxx, \"build"), |
| 770 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, " info"), |
| 771 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "\"),"), |
| 772 | ]], |
| 773 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 774 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " (xxxxxxxxx, \"build"), |
| 775 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "\"),"), |
| 776 | ]], |
| 777 | ), |
| 778 | 1.0, |
| 779 | ); |
| 780 | } |
| 781 | |
| 782 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 783 | fn test_infer_edits_13rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_13().() { |
| 784 | assert_paired_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_paired_edits().( |
| 785 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["'b '", "[element,]"], |
| 786 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["' b'", "[element],"], |
| 787 | ( |
| 788 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 789 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 790 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "'"), |
| 791 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "b"), |
| 792 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, " "), |
| 793 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "'"), |
| 794 | ], |
| 795 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "[element"), (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, ","), (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "]")], |
| 796 | ], |
| 797 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 798 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 799 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "'"), |
| 800 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 801 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "b"), |
| 802 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "'"), |
| 803 | ], |
| 804 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "[element"), (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "]"), (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, ",")], |
| 805 | ], |
| 806 | ), |
| 807 | ); |
| 808 | } |
| 809 | |
| 810 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 811 | fn test_infer_edits_14rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_14().() { |
| 812 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 813 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a b c d ", "p "], |
| 814 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["x y c z ", "q r"], |
| 815 | ( |
| 816 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 817 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 818 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, ""), |
| 819 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "a"), |
| 820 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, " "), |
| 821 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "b"), |
| 822 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, " c "), |
| 823 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "d"), |
| 824 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, " "), |
| 825 | ], |
| 826 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, ""), (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "p"), (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, " ")], |
| 827 | ], |
| 828 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 829 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 830 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, ""), |
| 831 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "x"), |
| 832 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, " "), |
| 833 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "y"), |
| 834 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " c"), |
| 835 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 836 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "z"), |
| 837 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 838 | ], |
| 839 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 840 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, ""), |
| 841 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "q"), |
| 842 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, " "), |
| 843 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "r"), |
| 844 | ], |
| 845 | ], |
| 846 | ), |
| 847 | 1.0, |
| 848 | ); |
| 849 | } |
| 850 | |
| 851 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 852 | fn test_infer_edits_15rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_15().() { |
| 853 | assert_paired_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_paired_edits().( |
| 854 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![r#"printf "%s\n" s y y | git add -p &&"#], |
| 855 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["test_write_lines s y y | git add -p &&"], |
| 856 | ( |
| 857 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 858 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, ""), |
| 859 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, r#"printf "%s\n""#), |
| 860 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, " s y y | git add -p &&"), |
| 861 | ]], |
| 862 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 863 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, ""), |
| 864 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "test_write_lines"), |
| 865 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " s y y | git add -p &&"), |
| 866 | ]], |
| 867 | ), |
| 868 | ); |
| 869 | } |
| 870 | |
| 871 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 872 | fn test_infer_edits_16rust-analyzer cargo git-delta 0.19.2 edits/tests/test_infer_edits_16().() { |
| 873 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 874 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["a a a a a a b b b"], |
| 875 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["c a a a a a a c c"], |
| 876 | ( |
| 877 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 878 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, ""), |
| 879 | (MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, "a a a a a a "), |
| 880 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "b b"), |
| 881 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, " "), |
| 882 | (Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, "b"), |
| 883 | ]], |
| 884 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 885 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, ""), |
| 886 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "c "), |
| 887 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, "a a a a a a"), |
| 888 | (PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, " "), |
| 889 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "c"), |
| 890 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, " "), |
| 891 | (Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, "c"), |
| 892 | ]], |
| 893 | ), |
| 894 | 1.0, |
| 895 | ); |
| 896 | } |
| 897 | |
| 898 | fn assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().( |
| 899 | minus_lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>, |
| 900 | plus_lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>, |
| 901 | expected_edits: Editsrust-analyzer cargo git-delta 0.19.2 edits/tests/Edits#, |
| 902 | max_line_distance: f64, |
| 903 | ) { |
| 904 | let (minus_lines, noop_deletions): (Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<EditOperationrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#>) = |
| 905 | minus_lines.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|s| (s, MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#)).unziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#unzip().(); |
| 906 | let (plus_lines, noop_insertions): (Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<EditOperationrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#>) = |
| 907 | plus_lines.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|s| (s, PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#)).unziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#unzip().(); |
| 908 | let actual_edits = infer_editsrust-analyzer cargo git-delta 0.19.2 edits/infer_edits().( |
| 909 | minus_lines, |
| 910 | plus_lines, |
| 911 | noop_deletions, |
| 912 | Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion#, |
| 913 | noop_insertions, |
| 914 | Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion#, |
| 915 | &DEFAULT_TOKENIZATION_REGEXPrust-analyzer cargo git-delta 0.19.2 edits/tests/DEFAULT_TOKENIZATION_REGEXP., |
| 916 | max_line_distance, |
| 917 | 0.0, |
| 918 | ); |
| 919 | // compare_annotated_lines(actual_edits, expected_edits); |
| 920 | // TODO: test line alignment |
| 921 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!((actual_edits.0, actual_edits.1), expected_edits); |
| 922 | } |
| 923 | |
| 924 | // Assert that no edits are inferred for the supplied minus and plus lines. |
| 925 | fn assert_no_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_no_edits().(minus_lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>, plus_lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>, max_line_distance: f64) { |
| 926 | let expected_edits = ( |
| 927 | minus_lines.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|s| vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop#, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().s)]).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 928 | plus_lines.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|s| vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop#, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().s)]).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 929 | ); |
| 930 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().(minus_lines, plus_lines, expected_edits, max_line_distance) |
| 931 | } |
| 932 | |
| 933 | // Assertions for a single pair of lines, considered as a homologous pair. We set |
| 934 | // max_line_distance = 1.0 in order that the pair will be inferred to be homologous. |
| 935 | fn assert_paired_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_paired_edits().(minus_lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>, plus_lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str>, expected_edits: Editsrust-analyzer cargo git-delta 0.19.2 edits/tests/Edits#) { |
| 936 | assert_consistent_pairsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_consistent_pairs().(&expected_edits); |
| 937 | assert_editsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_edits().(minus_lines, plus_lines, expected_edits, 1.0); |
| 938 | } |
| 939 | |
| 940 | fn assert_consistent_pairsrust-analyzer cargo git-delta 0.19.2 edits/tests/assert_consistent_pairs().(edits: &Editsrust-analyzer cargo git-delta 0.19.2 edits/tests/Edits#) { |
| 941 | let (minus_annotated_lines, plus_annotated_lines) = edits; |
| 942 | |
| 943 | for (minus_annotated_line, plus_annotated_line) in |
| 944 | minus_annotated_lines.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(plus_annotated_lines) |
| 945 | { |
| 946 | let (minus_total, minus_delta) = summarize_annotated_linerust-analyzer cargo git-delta 0.19.2 edits/tests/summarize_annotated_line().(minus_annotated_line); |
| 947 | let (plus_total, plus_delta) = summarize_annotated_linerust-analyzer cargo git-delta 0.19.2 edits/tests/summarize_annotated_line().(plus_annotated_line); |
| 948 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 949 | minus_total -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). minus_delta, |
| 950 | plus_total -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). plus_delta, |
| 951 | "\nInconsistent edits:\n \ |
| 952 | {:?}\n \ |
| 953 | \tminus_total - minus_delta = {} - {} = {}\n \ |
| 954 | {:?}\n \ |
| 955 | \tplus_total - plus_delta = {} - {} = {}\n", |
| 956 | minus_annotated_line, |
| 957 | minus_total, |
| 958 | minus_delta, |
| 959 | minus_total -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). minus_delta, |
| 960 | plus_annotated_line, |
| 961 | plus_total, |
| 962 | plus_delta, |
| 963 | plus_total -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). plus_delta |
| 964 | ); |
| 965 | } |
| 966 | } |
| 967 | |
| 968 | fn summarize_annotated_linerust-analyzer cargo git-delta 0.19.2 edits/tests/summarize_annotated_line().(sections: &AnnotatedLinerust-analyzer cargo git-delta 0.19.2 edits/tests/AnnotatedLine#) -> (usize, usize) { |
| 969 | let mut total = 0; |
| 970 | let mut delta = 0; |
| 971 | for (edit, s) in sections { |
| 972 | let length = s.graphemesrust-analyzer cargo unicode-segmentation 1.12.0 impl#[str][UnicodeSegmentation]graphemes().(true).countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#count().(); |
| 973 | total rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().length; |
| 974 | if is_editrust-analyzer cargo git-delta 0.19.2 edits/tests/is_edit().(edit) { |
| 975 | delta rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().length; |
| 976 | } |
| 977 | } |
| 978 | (total, delta) |
| 979 | } |
| 980 | |
| 981 | // For debugging test failures: |
| 982 | |
| 983 | #[allow(dead_code)] |
| 984 | fn compare_annotated_linesrust-analyzer cargo git-delta 0.19.2 edits/tests/compare_annotated_lines().(actual: Editsrust-analyzer cargo git-delta 0.19.2 edits/tests/Edits#, expected: Editsrust-analyzer cargo git-delta 0.19.2 edits/tests/Edits#) { |
| 985 | let (minus, plus) = actual; |
| 986 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("\n\nactual minus:"); |
| 987 | print_annotated_linesrust-analyzer cargo git-delta 0.19.2 edits/tests/print_annotated_lines().(minus); |
| 988 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("\nactual plus:"); |
| 989 | print_annotated_linesrust-analyzer cargo git-delta 0.19.2 edits/tests/print_annotated_lines().(plus); |
| 990 | |
| 991 | let (minus, plus) = expected; |
| 992 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("\n\nexpected minus:"); |
| 993 | print_annotated_linesrust-analyzer cargo git-delta 0.19.2 edits/tests/print_annotated_lines().(minus); |
| 994 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("\nexpected plus:"); |
| 995 | print_annotated_linesrust-analyzer cargo git-delta 0.19.2 edits/tests/print_annotated_lines().(plus); |
| 996 | } |
| 997 | |
| 998 | #[allow(dead_code)] |
| 999 | fn print_annotated_linesrust-analyzer cargo git-delta 0.19.2 edits/tests/print_annotated_lines().(annotated_lines: AnnotatedLinesrust-analyzer cargo git-delta 0.19.2 edits/tests/AnnotatedLines#) { |
| 1000 | for annotated_line in annotated_lines { |
| 1001 | print_annotated_linerust-analyzer cargo git-delta 0.19.2 edits/tests/print_annotated_line().(annotated_line); |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | #[allow(dead_code)] |
| 1006 | fn print_annotated_linerust-analyzer cargo git-delta 0.19.2 edits/tests/print_annotated_line().(annotated_line: AnnotatedLinerust-analyzer cargo git-delta 0.19.2 edits/tests/AnnotatedLine#) { |
| 1007 | for (edit, s) in annotated_line { |
| 1008 | printrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/print!!("({} {}), ", fmt_editrust-analyzer cargo git-delta 0.19.2 edits/tests/fmt_edit().(edit), s.trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().()); |
| 1009 | } |
| 1010 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!(); |
| 1011 | } |
| 1012 | |
| 1013 | #[allow(dead_code)] |
| 1014 | fn fmt_editrust-analyzer cargo git-delta 0.19.2 edits/tests/fmt_edit().(edit: EditOperationrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#) -> &'static str { |
| 1015 | match edit { |
| 1016 | MinusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#MinusNoop# => "MinusNoop", |
| 1017 | Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion# => "Deletion", |
| 1018 | PlusNooprust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#PlusNoop# => "PlusNoop", |
| 1019 | Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion# => "Insertion", |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | fn is_editrust-analyzer cargo git-delta 0.19.2 edits/tests/is_edit().(edit: &EditOperationrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#) -> bool { |
| 1024 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().edit rust-analyzer cargo git-delta 0.19.2 edits/tests/impl#[EditOperation][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 edits/tests/impl#[EditOperation][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 edits/tests/impl#[EditOperation][`PartialEq<Self>`]eq().Deletionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Deletion# || *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().edit rust-analyzer cargo git-delta 0.19.2 edits/tests/impl#[EditOperation][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 edits/tests/impl#[EditOperation][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 edits/tests/impl#[EditOperation][`PartialEq<Self>`]eq().Insertionrust-analyzer cargo git-delta 0.19.2 edits/tests/EditOperation#Insertion# |
| 1025 | } |
| 1026 | } |