This commit is contained in:
dullbananas 2024-05-22 13:43:08 -07:00 committed by GitHub
parent f1142e0c72
commit 7716c9e16d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -46,9 +46,7 @@ pub fn check_dump_diff(mut after: String, mut before: String, label: &str) {
.map(|dump| chunks(dump).collect::<BTreeSet<_>>()) .map(|dump| chunks(dump).collect::<BTreeSet<_>>())
.differences() .differences()
// Remove items without unwanted types of differences (if migrations are correct, then this removes everything) // Remove items without unwanted types of differences (if migrations are correct, then this removes everything)
.map(|chunks| { .map(|chunks| chunks.map(|&i| normalize_chunk(i)).collect::<BTreeSet<_>>());
chunks.map(|&i| normalize_chunk(i)).collect::<BTreeSet<_>>()
});
let [mut only_in_before, mut only_in_after] = normalized_chunk_vecs let [mut only_in_before, mut only_in_after] = normalized_chunk_vecs
.differences() .differences()
@ -257,7 +255,7 @@ fn normalize_chunk<'a>(chunk: &'a str) -> Cow<'a, str> {
} }
fn sort_within_sections<T: Ord + ?Sized>(vec: &mut Vec<&T>, mut section: impl FnMut(&T) -> u8) { fn sort_within_sections<T: Ord + ?Sized>(vec: &mut Vec<&T>, mut section: impl FnMut(&T) -> u8) {
vec.sort_unstable_by_key(|&i|(section(i),i)); vec.sort_unstable_by_key(|&i| (section(i), i));
} }
fn chunks(dump: &str) -> impl Iterator<Item = &str> { fn chunks(dump: &str) -> impl Iterator<Item = &str> {