Do intersection with displayed ids instead of checking in loop

This commit is contained in:
Clémentine Urquizar 2021-06-15 17:28:26 +02:00
parent 8d0269fcc4
commit 79a1212ebe
No known key found for this signature in database
GPG Key ID: D8E7CC7422E77E1A

View File

@ -162,6 +162,9 @@ impl Index {
.keys()
.cloned()
.collect::<HashSet<_>>()
.intersection(&displayed_ids)
.cloned()
.collect::<HashSet<_>>()
.union(&to_retrieve_ids)
.cloned()
.sorted()
@ -240,10 +243,8 @@ fn parse_formatted_options(
}
if let Some(id) = fields_ids_map.id(&attr) {
if displayed_ids.contains(&id) {
formatted_options.insert(id, new_format);
}
}
};
for attr in attr_to_crop {
@ -274,7 +275,6 @@ fn parse_formatted_options(
}
if let Some(id) = fields_ids_map.id(&attr_name) {
if displayed_ids.contains(&id) {
let mut highlight = false;
if let Some(f) = formatted_options.get(&id) {
highlight = f.highlight;
@ -285,7 +285,6 @@ fn parse_formatted_options(
});
}
}
}
formatted_options
}