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:
parent
f02a925e3f
commit
a70f72603f
@ -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>()
|
||||
)
|
||||
}
|
||||
|
@ -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>()
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user