chore: fmt + clippy
This commit is contained in:
@ -80,10 +80,7 @@ mod tests {
|
||||
fn collapsed_category_shows_header_only() {
|
||||
let m = make_model_with_categories(&[("Region", &["North", "South"])]);
|
||||
let tree = build_cat_tree(&m, &HashSet::new());
|
||||
let region_entries: Vec<_> = tree
|
||||
.iter()
|
||||
.filter(|e| e.cat_name() == "Region")
|
||||
.collect();
|
||||
let region_entries: Vec<_> = tree.iter().filter(|e| e.cat_name() == "Region").collect();
|
||||
assert_eq!(region_entries.len(), 1); // just the header
|
||||
assert!(matches!(
|
||||
region_entries[0],
|
||||
@ -101,13 +98,13 @@ mod tests {
|
||||
let mut expanded = HashSet::new();
|
||||
expanded.insert("Region".to_string());
|
||||
let tree = build_cat_tree(&m, &expanded);
|
||||
let region_entries: Vec<_> = tree
|
||||
.iter()
|
||||
.filter(|e| e.cat_name() == "Region")
|
||||
.collect();
|
||||
let region_entries: Vec<_> = tree.iter().filter(|e| e.cat_name() == "Region").collect();
|
||||
// Header + 2 items
|
||||
assert_eq!(region_entries.len(), 3);
|
||||
assert!(matches!(region_entries[0], CatTreeEntry::Category { expanded: true, .. }));
|
||||
assert!(matches!(
|
||||
region_entries[0],
|
||||
CatTreeEntry::Category { expanded: true, .. }
|
||||
));
|
||||
assert!(matches!(region_entries[1], CatTreeEntry::Item { .. }));
|
||||
assert!(matches!(region_entries[2], CatTreeEntry::Item { .. }));
|
||||
}
|
||||
@ -124,15 +121,11 @@ mod tests {
|
||||
|
||||
let region_items: Vec<_> = tree
|
||||
.iter()
|
||||
.filter(|e| {
|
||||
e.cat_name() == "Region" && matches!(e, CatTreeEntry::Item { .. })
|
||||
})
|
||||
.filter(|e| e.cat_name() == "Region" && matches!(e, CatTreeEntry::Item { .. }))
|
||||
.collect();
|
||||
let product_items: Vec<_> = tree
|
||||
.iter()
|
||||
.filter(|e| {
|
||||
e.cat_name() == "Product" && matches!(e, CatTreeEntry::Item { .. })
|
||||
})
|
||||
.filter(|e| e.cat_name() == "Product" && matches!(e, CatTreeEntry::Item { .. }))
|
||||
.collect();
|
||||
assert_eq!(region_items.len(), 0); // collapsed
|
||||
assert_eq!(product_items.len(), 3); // expanded
|
||||
|
||||
Reference in New Issue
Block a user