Skip to content

Commit

Permalink
fix: flip is_ok with is_err for checking early returns
Browse files Browse the repository at this point in the history
  • Loading branch information
ripytide committed Nov 17, 2024
1 parent 2a6feee commit 6a0421b
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/backends/apt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Backend for Apt {
}

fn query_installed_packages(config: &Config) -> Result<BTreeMap<String, Self::QueryInfo>> {
if Self::version(config).is_ok() {
if Self::version(config).is_err() {
return Ok(BTreeMap::new());
}

Expand Down
4 changes: 2 additions & 2 deletions src/backends/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Backend for Arch {
mut packages: BTreeMap<String, Self::InstallOptions>,
config: &Config,
) -> Result<BTreeMap<String, Self::InstallOptions>> {
if Self::version(config).is_ok() {
if Self::version(config).is_err() {
return Ok(BTreeMap::new());
}

Expand Down Expand Up @@ -94,7 +94,7 @@ impl Backend for Arch {
}

fn query_installed_packages(config: &Config) -> Result<BTreeMap<String, Self::QueryInfo>> {
if Self::version(config).is_ok() {
if Self::version(config).is_err() {
return Ok(BTreeMap::new());
}

Expand Down
2 changes: 1 addition & 1 deletion src/backends/brew.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Backend for Brew {
}

fn query_installed_packages(config: &Config) -> Result<BTreeMap<String, Self::QueryInfo>> {
if Self::version(config).is_ok() {
if Self::version(config).is_err() {
return Ok(BTreeMap::new());
}

Expand Down
2 changes: 1 addition & 1 deletion src/backends/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Backend for Cargo {
}

fn query_installed_packages(config: &Config) -> Result<BTreeMap<String, Self::QueryInfo>> {
if Self::version(config).is_ok() {
if Self::version(config).is_err() {
return Ok(BTreeMap::new());
}

Expand Down
2 changes: 1 addition & 1 deletion src/backends/dnf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Backend for Dnf {
}

fn query_installed_packages(config: &Config) -> Result<BTreeMap<String, Self::QueryInfo>> {
if Self::version(config).is_ok() {
if Self::version(config).is_err() {
return Ok(BTreeMap::new());
}

Expand Down
2 changes: 1 addition & 1 deletion src/backends/flatpak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Backend for Flatpak {
}

fn query_installed_packages(config: &Config) -> Result<BTreeMap<String, Self::QueryInfo>> {
if Self::version(config).is_ok() {
if Self::version(config).is_err() {
return Ok(BTreeMap::new());
}

Expand Down
2 changes: 1 addition & 1 deletion src/backends/pipx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Backend for Pipx {
}

fn query_installed_packages(config: &Config) -> Result<BTreeMap<String, Self::QueryInfo>> {
if Self::version(config).is_ok() {
if Self::version(config).is_err() {
return Ok(BTreeMap::new());
}

Expand Down
2 changes: 1 addition & 1 deletion src/backends/rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Backend for Rustup {
}

fn query_installed_packages(config: &Config) -> Result<BTreeMap<String, Self::QueryInfo>> {
if Self::version(config).is_ok() {
if Self::version(config).is_err() {
return Ok(BTreeMap::new());
}

Expand Down
2 changes: 1 addition & 1 deletion src/backends/winget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl Backend for WinGet {
}

fn query_installed_packages(config: &Config) -> Result<BTreeMap<String, Self::QueryInfo>> {
if Self::version(config).is_ok() {
if Self::version(config).is_err() {
return Ok(BTreeMap::new());
}

Expand Down
2 changes: 1 addition & 1 deletion src/backends/xbps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Backend for Xbps {
fn query_installed_packages(
config: &Config,
) -> Result<std::collections::BTreeMap<String, Self::QueryInfo>> {
if Self::version(config).is_ok() {
if Self::version(config).is_err() {
return Ok(BTreeMap::new());
}

Expand Down

0 comments on commit 6a0421b

Please sign in to comment.