Skip to content

Commit

Permalink
Use map.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansundin committed Oct 3, 2022
1 parent f9c0407 commit de7fc42
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,16 @@ async fn main() -> Result<(), std::io::Error> {
if input.allocation_id.is_some() {
allocation_id = input.allocation_id.unwrap();
} else if let Some(filters) = input.filters {
// Convert the filters to the SDK filters
// This is a bit annoying, is there a better way?
let mut filters_input: Vec<aws_sdk_ec2::model::Filter> = vec![];
for filter in filters.into_iter() {
filters_input.push(
// Convert the filters to SDK filters
let filters_input = filters
.into_iter()
.map(|filter| {
aws_sdk_ec2::model::Filter::builder()
.name(filter.name)
.set_values(Some(filter.values))
.build(),
);
}
.build()
})
.collect();
println!("Filters: {:?}", filters_input);

// Describe the addresses
Expand Down

0 comments on commit de7fc42

Please sign in to comment.