diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /vendor/array_tool/alternates.txt | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/array_tool/alternates.txt')
-rw-r--r-- | vendor/array_tool/alternates.txt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/vendor/array_tool/alternates.txt b/vendor/array_tool/alternates.txt new file mode 100644 index 000000000..3e13f17cf --- /dev/null +++ b/vendor/array_tool/alternates.txt @@ -0,0 +1,37 @@ +43% SLOWER implementation + +pub fn experimental_uniques<T: std::cmp::PartialEq<T> + std::clone::Clone>(a: Vec<T>, b: Vec<T>) -> Vec<Vec<T>> { + let mut first_uniq = a.clone(); + let mut second_uniq = b.clone(); + + let mut x = first_uniq.len(); + + 'outer: loop { + x -= 1; + let mut y = second_uniq.len(); + let mut removed = false; + 'inner: loop { + y -= 1; + if first_uniq[x] == second_uniq[y] { + first_uniq.remove(x); + second_uniq.remove(y); + removed = true + } + if x == 0{ + if y == 0{ + break 'outer + } + } + else { + if y == 0{ + break + } + if removed { + continue 'outer + } + } + } + } + + vec![first_uniq, second_uniq] +} |