Skip to content

Commit

Permalink
refactor: Rework find_app impl
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmicHorrorDev committed Oct 25, 2024
1 parent 3901244 commit 43863ab
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,13 @@ impl SteamDir {
/// ```
pub fn find_app(&self, app_id: u32) -> Result<Option<(App, Library)>> {
// Search for the `app_id` in each library
match self.libraries() {
Err(e) => Err(e),
Ok(libraries) => libraries
.filter_map(|library| library.ok())
.find_map(|lib| {
lib.app(app_id)
.map(|maybe_app| maybe_app.map(|app| (app, lib)))
})
.transpose(),
}
self.libraries()?
.filter_map(|library| library.ok())
.find_map(|lib| {
lib.app(app_id)
.map(|maybe_app| maybe_app.map(|app| (app, lib)))
})
.transpose()
}

pub fn compat_tool_mapping(&self) -> Result<HashMap<u32, CompatTool>> {
Expand Down

0 comments on commit 43863ab

Please sign in to comment.