1
0
mirror of https://github.com/pcvolkmer/osc-variant.git synced 2025-04-19 11:46:50 +00:00

refactor: use filter_map()

This commit is contained in:
Paul-Christian Volkmer 2025-01-01 19:47:08 +01:00
parent f02a925e3f
commit a70f72603f
2 changed files with 2 additions and 6 deletions

View File

@ -127,15 +127,13 @@ impl Requires for DataCatalogue {
self.to_listed_string(),
self.get_required_entries(all)
.iter()
.map(|entry| match entry {
.filter_map(|entry| match entry {
Requirement::PropertyCatalogue(_)
| Requirement::ExternalPropertyCatalogue(_) => {
Some(format!(" - {entry}\n"))
}
_ => None,
})
.filter(Option::is_some)
.flatten()
.collect::<String>()
)
}

View File

@ -111,7 +111,7 @@ where
self.to_listed_string(),
self.get_required_entries(all)
.iter()
.map(|entry| match entry {
.filter_map(|entry| match entry {
Requirement::DataCatalogue(x) => {
let inner = x
.get_required_entries(all)
@ -148,8 +148,6 @@ where
}
_ => None,
})
.filter(Option::is_some)
.flatten()
.collect::<String>()
)
}