From 1559e3794924304e045dd2b9f45153daca7b3cfa Mon Sep 17 00:00:00 2001 From: ripytide Date: Mon, 23 Dec 2024 21:36:50 +0000 Subject: [PATCH] cargo fmt --- src/backends/apt.rs | 5 +---- src/backends/arch.rs | 6 +----- src/backends/brew.rs | 11 ++--------- src/backends/cargo.rs | 6 +----- src/backends/mod.rs | 6 +----- src/backends/pipx.rs | 16 +++------------- src/backends/rustup.rs | 6 +----- src/backends/snap.rs | 6 +----- src/backends/winget.rs | 11 ++--------- src/backends/xbps.rs | 9 ++------- src/core.rs | 3 +-- src/groups.rs | 5 +---- 12 files changed, 17 insertions(+), 73 deletions(-) diff --git a/src/backends/apt.rs b/src/backends/apt.rs index 9cd19ad..20a708b 100644 --- a/src/backends/apt.rs +++ b/src/backends/apt.rs @@ -83,10 +83,7 @@ impl Backend for Apt { run_command_for_stdout(["apt", "--version"], Perms::Same, false) } - fn missing( - required: Self::Options, - installed: Option, - ) -> Option { + fn missing(required: Self::Options, installed: Option) -> Option { match installed { Some(_) => None, None => Some(required), diff --git a/src/backends/arch.rs b/src/backends/arch.rs index 40d56b2..34c0f42 100644 --- a/src/backends/arch.rs +++ b/src/backends/arch.rs @@ -171,11 +171,7 @@ impl Backend for Arch { Ok(()) } - fn remove( - packages: &BTreeSet, - no_confirm: bool, - config: &Config, - ) -> Result<()> { + fn remove(packages: &BTreeSet, no_confirm: bool, config: &Config) -> Result<()> { if !packages.is_empty() { run_command( [ diff --git a/src/backends/brew.rs b/src/backends/brew.rs index 27962be..6a67af4 100644 --- a/src/backends/brew.rs +++ b/src/backends/brew.rs @@ -39,11 +39,7 @@ impl Backend for Brew { .collect()) } - fn install( - packages: &BTreeMap, - _: bool, - _: &Config, - ) -> Result<()> { + fn install(packages: &BTreeMap, _: bool, _: &Config) -> Result<()> { if !packages.is_empty() { run_command( ["brew", "install"] @@ -79,10 +75,7 @@ impl Backend for Brew { run_command_for_stdout(["brew", "--version"], Perms::Same, false) } - fn missing( - required: Self::Options, - installed: Option, - ) -> Option { + fn missing(required: Self::Options, installed: Option) -> Option { match installed { Some(_) => None, None => Some(required), diff --git a/src/backends/cargo.rs b/src/backends/cargo.rs index 21537b9..93b5495 100644 --- a/src/backends/cargo.rs +++ b/src/backends/cargo.rs @@ -59,11 +59,7 @@ impl Backend for Cargo { extract_packages(&contents).wrap_err("extracting packages from crates file") } - fn install( - packages: &BTreeMap, - _: bool, - _: &Config, - ) -> Result<()> { + fn install(packages: &BTreeMap, _: bool, _: &Config) -> Result<()> { for (package, options) in packages { run_command( ["cargo", "install"] diff --git a/src/backends/mod.rs b/src/backends/mod.rs index d19a0c9..4d2af98 100644 --- a/src/backends/mod.rs +++ b/src/backends/mod.rs @@ -56,11 +56,7 @@ pub trait Backend { config: &Config, ) -> Result<()>; - fn remove( - packages: &BTreeSet, - no_confirm: bool, - config: &Config, - ) -> Result<()>; + fn remove(packages: &BTreeSet, no_confirm: bool, config: &Config) -> Result<()>; fn clean_cache(config: &Config) -> Result<()>; diff --git a/src/backends/pipx.rs b/src/backends/pipx.rs index c354404..07a8d62 100644 --- a/src/backends/pipx.rs +++ b/src/backends/pipx.rs @@ -38,17 +38,10 @@ impl Backend for Pipx { true, )?)?; - Ok(names - .into_iter() - .map(|x| (x, Self::Options {})) - .collect()) + Ok(names.into_iter().map(|x| (x, Self::Options {})).collect()) } - fn install( - packages: &BTreeMap, - _: bool, - _: &Config, - ) -> Result<()> { + fn install(packages: &BTreeMap, _: bool, _: &Config) -> Result<()> { if !packages.is_empty() { run_command( ["pipx", "install"] @@ -82,10 +75,7 @@ impl Backend for Pipx { run_command_for_stdout(["pipx", "--version"], Perms::Same, false) } - fn missing( - required: Self::Options, - installed: Option, - ) -> Option { + fn missing(required: Self::Options, installed: Option) -> Option { match installed { Some(_) => None, None => Some(required), diff --git a/src/backends/rustup.rs b/src/backends/rustup.rs index 12af6f8..29398ff 100644 --- a/src/backends/rustup.rs +++ b/src/backends/rustup.rs @@ -72,11 +72,7 @@ impl Backend for Rustup { Ok(packages) } - fn install( - packages: &BTreeMap, - _: bool, - _: &Config, - ) -> Result<()> { + fn install(packages: &BTreeMap, _: bool, _: &Config) -> Result<()> { for (toolchain, rustup_options) in packages.iter() { run_command( ["rustup", "toolchain", "install", toolchain.as_str()], diff --git a/src/backends/snap.rs b/src/backends/snap.rs index eb81048..3ebed8d 100644 --- a/src/backends/snap.rs +++ b/src/backends/snap.rs @@ -38,11 +38,7 @@ impl Backend for Snap { .collect()) } - fn install( - packages: &BTreeMap, - _: bool, - _: &Config, - ) -> Result<()> { + fn install(packages: &BTreeMap, _: bool, _: &Config) -> Result<()> { if !packages.is_empty() { run_command( ["snap", "install"] diff --git a/src/backends/winget.rs b/src/backends/winget.rs index 550ad2a..4e248c5 100644 --- a/src/backends/winget.rs +++ b/src/backends/winget.rs @@ -61,11 +61,7 @@ impl Backend for WinGet { .collect()) } - fn install( - packages: &BTreeMap, - _: bool, - _: &Config, - ) -> Result<()> { + fn install(packages: &BTreeMap, _: bool, _: &Config) -> Result<()> { if !packages.is_empty() { run_command( ["winget", "install"] @@ -101,10 +97,7 @@ impl Backend for WinGet { run_command_for_stdout(["winget", "--version"], Perms::Same, false) } - fn missing( - required: Self::Options, - installed: Option, - ) -> Option { + fn missing(required: Self::Options, installed: Option) -> Option { match installed { Some(_) => None, None => Some(required), diff --git a/src/backends/xbps.rs b/src/backends/xbps.rs index 6b13dad..4c20fc9 100644 --- a/src/backends/xbps.rs +++ b/src/backends/xbps.rs @@ -24,9 +24,7 @@ impl Backend for Xbps { Ok(packages) } - fn query( - config: &Config, - ) -> Result> { + fn query(config: &Config) -> Result> { if Self::version(config).is_err() { return Ok(BTreeMap::new()); } @@ -95,10 +93,7 @@ impl Backend for Xbps { run_command_for_stdout(["xbps-query", "--version"], Perms::Same, false) } - fn missing( - required: Self::Options, - installed: Option, - ) -> Option { + fn missing(required: Self::Options, installed: Option) -> Option { match installed { Some(_) => None, None => Some(required), diff --git a/src/core.rs b/src/core.rs index c8f74bb..9d335b9 100644 --- a/src/core.rs +++ b/src/core.rs @@ -218,8 +218,7 @@ impl CleanCacheCommand { } fn unmanaged(required: &Options, config: &Config) -> Result { - Options::query(config) - .map(|x| x.to_package_ids().difference(&required.to_package_ids())) + Options::query(config).map(|x| x.to_package_ids().difference(&required.to_package_ids())) } fn missing(required: &Options, config: &Config) -> Result { let installed = Options::query(config)?; diff --git a/src/groups.rs b/src/groups.rs index 7ce6cfa..1263df5 100644 --- a/src/groups.rs +++ b/src/groups.rs @@ -19,10 +19,7 @@ impl Groups { pub fn contains(&self, backend: AnyBackend, package: &str) -> Vec { let mut result = Vec::new(); for (group_file, raw_options) in self.0.iter() { - if raw_options - .to_raw_package_ids() - .contains(backend, package) - { + if raw_options.to_raw_package_ids().contains(backend, package) { result.push(group_file.clone()); } }