1
0
mirror of https://github.com/pcvolkmer/osc-variant.git synced 2025-04-19 19:56: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.to_listed_string(),
self.get_required_entries(all) self.get_required_entries(all)
.iter() .iter()
.map(|entry| match entry { .filter_map(|entry| match entry {
Requirement::PropertyCatalogue(_) Requirement::PropertyCatalogue(_)
| Requirement::ExternalPropertyCatalogue(_) => { | Requirement::ExternalPropertyCatalogue(_) => {
Some(format!(" - {entry}\n")) Some(format!(" - {entry}\n"))
} }
_ => None, _ => None,
}) })
.filter(Option::is_some)
.flatten()
.collect::<String>() .collect::<String>()
) )
} }

View File

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