Skip to content

Commit 7c4e9ab

Browse files
committed
lint: minor cleanup
1 parent b7e35e1 commit 7c4e9ab

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

alpm-utils/src/alpm.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1+
//! Extension methods for the [`Alpm`] type.
2+
13
use crate::depends::satisfies_ver;
24
use crate::DbListExt;
3-
use alpm::{Alpm, Depend, Package, PackageReason, Result, SigLevel};
5+
use alpm::{Alpm, Depend, Package, PackageReason, SigLevel};
46
use std::path::Path;
57

68
/// Extension methods to the [`Alpm`] type.
79
pub trait AlpmExt {
810
/// Try to find a [`Package`] that satisfies a given dependency.
9-
fn find_local_satisfier<S>(&self, pkg: S) -> Result<Option<Package<'_>>>
11+
fn find_local_satisfier<S>(&self, pkg: S) -> Option<Package<'_>>
1012
where
1113
S: Into<String>;
1214
}
1315

1416
impl AlpmExt for Alpm {
15-
fn find_local_satisfier<S>(&self, pkg: S) -> Result<Option<Package<'_>>>
17+
fn find_local_satisfier<S>(&self, pkg: S) -> Option<Package<'_>>
1618
where
1719
S: Into<String>,
1820
{
1921
let localdb = self.localdb();
2022
let pkg = pkg.into();
2123

22-
if let Ok(alpm_pkg) = localdb.pkg(pkg.as_str()) {
23-
if satisfies_ver(Depend::new(pkg.as_str()), alpm_pkg.version()) {
24-
return Ok(Some(alpm_pkg));
24+
match localdb.pkg(pkg.as_str()) {
25+
Ok(alpm_pkg) if satisfies_ver(Depend::new(pkg.as_str()), alpm_pkg.version()) => {
26+
Some(alpm_pkg)
2527
}
28+
_ => localdb.pkgs().find_satisfier(pkg),
2629
}
27-
28-
Ok(localdb.pkgs().find_satisfier(pkg))
2930
}
3031
}
3132

0 commit comments

Comments
 (0)