Lint & format

This commit is contained in:
Andras Schmelczer 2025-04-06 11:39:40 +01:00
commit 48f301d8ab
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
9 changed files with 54 additions and 57 deletions

View file

@ -66,11 +66,9 @@ impl ExampleDocument {
result.insert(
result
.char_indices()
.skip(cursor.char_index + i)
.next()
.map(|(byte_index, _)| byte_index)
.unwrap_or_else(|| result.len()), /* find the utf8 char index of the insert
* in byte index */
.nth(cursor.char_index + i)
.map_or_else(|| result.len(), |(byte_index, _)| byte_index), /* find the utf8 char index of the insert
* in byte index */
'|',
);
}

View file

@ -8,46 +8,46 @@ use serde::Deserialize;
#[test]
fn test_document_one_way_without_cursors() {
get_all_documents().iter().for_each(|doc| {
for doc in &get_all_documents() {
doc.assert_eq_without_cursors(&reconcile(
&doc.parent(),
&doc.left().text,
&doc.right().text,
))
});
));
}
}
#[test]
fn test_document_one_way_with_cursors() {
get_all_documents().iter().for_each(|doc| {
for doc in &get_all_documents() {
doc.assert_eq(&reconcile_with_cursors(
&doc.parent(),
doc.left(),
doc.right(),
))
});
));
}
}
#[test]
fn test_document_inverse_way_without_cursors() {
get_all_documents().iter().for_each(|doc| {
for doc in &get_all_documents() {
doc.assert_eq_without_cursors(&reconcile(
&doc.parent(),
&doc.right().text,
&doc.left().text,
));
});
}
}
#[test]
fn test_document_inverse_way_with_cursors() {
get_all_documents().iter().for_each(|doc| {
for doc in &get_all_documents() {
doc.assert_eq(&reconcile_with_cursors(
&doc.parent(),
doc.right(),
doc.left(),
))
});
));
}
}
fn get_all_documents() -> Vec<ExampleDocument> {