Skip to content

Commit

Permalink
fix: use Result::transpose instead of manual implementation (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
swarnimarun authored Sep 14, 2023
1 parent 68908a8 commit 11ef15c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/render/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,7 @@ pub async fn create_environment(
.await
// Collect into another iterator where we extract the first erroneous result
.into_iter()
.filter_map(|res| match res {
Ok(Some(data)) => Some(Ok(data)), // If Ok contains Some, keep the data
Ok(None) => None, // If Ok contains None, discard it
Err(e) => Some(Err(e)), // If Err, keep it as is
})
.filter_map(Result::transpose)
.collect::<Result<Vec<_>, _>>()?;

// Get the package names from the matchspecs so we can only load the package records that we need.
Expand Down

0 comments on commit 11ef15c

Please sign in to comment.