Satisfy rustfmt and clippy on the album and folder picker changes

rustfmt over the files the albums work touched, and the album merge's
incoming row as a named struct rather than an eight-field tuple, which
clippy's type_complexity refused.
This commit is contained in:
2026-09-26 14:13:54 -04:00
parent 1abb18d972
commit 9b580c3720
18 changed files with 487 additions and 303 deletions
+92 -22
View File
@@ -415,8 +415,8 @@ mod tests {
let catalog = with_images(10);
let ids = image_ids(&catalog);
let album = albums::create(catalog.connection(), "Web", &Place::Local("/out".into()))
.unwrap();
let album =
albums::create(catalog.connection(), "Web", &Place::Local("/out".into())).unwrap();
// Two files from one photograph, one from another: two cells.
albums::record_exports(
catalog.connection(),
@@ -460,10 +460,22 @@ mod tests {
.unwrap();
coll::add_images(catalog.connection(), c, &ids[2..5]).unwrap();
let cells = read_cells_scoped(&catalog, Some(Scope::Collection(c)), &RatingFilter::default(), 0, 120).unwrap();
let cells = read_cells_scoped(
&catalog,
Some(Scope::Collection(c)),
&RatingFilter::default(),
0,
120,
)
.unwrap();
assert_eq!(cells.len(), 3);
assert_eq!(
total_images_scoped(&catalog, Some(Scope::Collection(c)), &RatingFilter::default()).unwrap(),
total_images_scoped(
&catalog,
Some(Scope::Collection(c)),
&RatingFilter::default()
)
.unwrap(),
3
);
// Unscoped is still the whole library.
@@ -493,11 +505,22 @@ mod tests {
coll::add_images(catalog.connection(), iceland, &ids[0..4]).unwrap();
// The parent itself has no direct members at all.
let cells =
read_cells_scoped(&catalog, Some(Scope::Collection(trips)), &RatingFilter::default(), 0, 120).unwrap();
let cells = read_cells_scoped(
&catalog,
Some(Scope::Collection(trips)),
&RatingFilter::default(),
0,
120,
)
.unwrap();
assert_eq!(cells.len(), 4, "the set shows what its children hold");
assert_eq!(
total_images_scoped(&catalog, Some(Scope::Collection(trips)), &RatingFilter::default()).unwrap(),
total_images_scoped(
&catalog,
Some(Scope::Collection(trips)),
&RatingFilter::default()
)
.unwrap(),
4
);
}
@@ -522,11 +545,22 @@ mod tests {
coll::add_images(catalog.connection(), trips, &ids[0..2]).unwrap();
coll::add_images(catalog.connection(), iceland, &ids[0..3]).unwrap();
let cells =
read_cells_scoped(&catalog, Some(Scope::Collection(trips)), &RatingFilter::default(), 0, 120).unwrap();
let cells = read_cells_scoped(
&catalog,
Some(Scope::Collection(trips)),
&RatingFilter::default(),
0,
120,
)
.unwrap();
assert_eq!(cells.len(), 3, "images 0..3, each once");
assert_eq!(
total_images_scoped(&catalog, Some(Scope::Collection(trips)), &RatingFilter::default()).unwrap(),
total_images_scoped(
&catalog,
Some(Scope::Collection(trips)),
&RatingFilter::default()
)
.unwrap(),
3
);
}
@@ -542,7 +576,14 @@ mod tests {
let c = coll::create(catalog.connection(), "Big", None, CollectionKind::Manual).unwrap();
coll::add_images(catalog.connection(), c, &ids).unwrap();
let page = read_cells_scoped(&catalog, Some(Scope::Collection(c)), &RatingFilter::default(), 10, 5).unwrap();
let page = read_cells_scoped(
&catalog,
Some(Scope::Collection(c)),
&RatingFilter::default(),
10,
5,
)
.unwrap();
assert_eq!(page.len(), 5);
assert_eq!(page[0].name, "img010.CR2");
}
@@ -556,13 +597,22 @@ mod tests {
let catalog = with_images(10);
let c = coll::create(catalog.connection(), "Empty", None, CollectionKind::Manual).unwrap();
assert!(
read_cells_scoped(&catalog, Some(Scope::Collection(c)), &RatingFilter::default(), 0, 120)
.unwrap()
.is_empty()
);
assert!(read_cells_scoped(
&catalog,
Some(Scope::Collection(c)),
&RatingFilter::default(),
0,
120
)
.unwrap()
.is_empty());
assert_eq!(
total_images_scoped(&catalog, Some(Scope::Collection(c)), &RatingFilter::default()).unwrap(),
total_images_scoped(
&catalog,
Some(Scope::Collection(c)),
&RatingFilter::default()
)
.unwrap(),
0
);
}
@@ -671,15 +721,29 @@ mod tests {
let wanted: Vec<_> = all.iter().rev().copied().collect();
dr_catalog::collections::set_order(catalog.connection(), id, &wanted).unwrap();
let cells = read_cells_scoped(&catalog, Some(Scope::Collection(id)), &RatingFilter::default(), 0, 50).unwrap();
let cells = read_cells_scoped(
&catalog,
Some(Scope::Collection(id)),
&RatingFilter::default(),
0,
50,
)
.unwrap();
let drawn: Vec<_> = cells
.iter()
.map(|c| dr_types::ImageId(c.image_id as u64))
.collect();
assert_eq!(drawn, wanted, "the grid draws the order that was written");
let spanned =
read_ids_span(&catalog, Some(Scope::Collection(id)), &RatingFilter::default(), false, 0, 4).unwrap();
let spanned = read_ids_span(
&catalog,
Some(Scope::Collection(id)),
&RatingFilter::default(),
false,
0,
4,
)
.unwrap();
assert_eq!(spanned, wanted, "and a range resolves through the same one");
assert_eq!(
@@ -715,8 +779,14 @@ mod tests {
let reversed: Vec<_> = all.iter().rev().copied().collect();
dr_catalog::collections::set_order(catalog.connection(), parent, &reversed).unwrap();
let cells =
read_cells_scoped(&catalog, Some(Scope::Collection(parent)), &RatingFilter::default(), 0, 50).unwrap();
let cells = read_cells_scoped(
&catalog,
Some(Scope::Collection(parent)),
&RatingFilter::default(),
0,
50,
)
.unwrap();
let drawn: Vec<_> = cells
.iter()
.map(|c| dr_types::ImageId(c.image_id as u64))