From f07114fdfd813d329b5d0880a2b4a6944396272e Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Thu, 4 Oct 2018 11:40:29 +0300 Subject: [PATCH] Format change --- src/generic.rs | 64 +++++++++----------------------------------------- 1 file changed, 11 insertions(+), 53 deletions(-) diff --git a/src/generic.rs b/src/generic.rs index e1fb7f42..262dd87c 100644 --- a/src/generic.rs +++ b/src/generic.rs @@ -9,16 +9,8 @@ use std::process::Command; const EMACS_UPGRADE: &str = include_str!("emacs.el"); #[must_use] -pub fn run_cargo_update( - base_dirs: &BaseDirs, - terminal: &mut Terminal, - dry_run: bool, -) -> Option<(&'static str, bool)> { - if let Some(cargo_update) = base_dirs - .home_dir() - .join(".cargo/bin/cargo-install-update") - .if_exists() - { +pub fn run_cargo_update(base_dirs: &BaseDirs, terminal: &mut Terminal, dry_run: bool) -> Option<(&'static str, bool)> { + if let Some(cargo_update) = base_dirs.home_dir().join(".cargo/bin/cargo-install-update").if_exists() { terminal.print_separator("Cargo"); let success = || -> Result<(), Error> { @@ -38,11 +30,7 @@ pub fn run_cargo_update( } #[must_use] -pub fn run_gem( - base_dirs: &BaseDirs, - terminal: &mut Terminal, - dry_run: bool, -) -> Option<(&'static str, bool)> { +pub fn run_gem(base_dirs: &BaseDirs, terminal: &mut Terminal, dry_run: bool) -> Option<(&'static str, bool)> { if let Some(gem) = utils::which("gem") { if base_dirs.home_dir().join(".gem").exists() { terminal.print_separator("RubyGems"); @@ -64,24 +52,15 @@ pub fn run_gem( } #[must_use] -pub fn run_emacs( - base_dirs: &BaseDirs, - terminal: &mut Terminal, - dry_run: bool, -) -> Option<(&'static str, bool)> { +pub fn run_emacs(base_dirs: &BaseDirs, terminal: &mut Terminal, dry_run: bool) -> Option<(&'static str, bool)> { if let Some(emacs) = utils::which("emacs") { if let Some(init_file) = base_dirs.home_dir().join(".emacs.d/init.el").if_exists() { terminal.print_separator("Emacs"); let success = || -> Result<(), Error> { Executor::new(&emacs, dry_run) - .args(&[ - "--batch", - "-l", - init_file.to_str().unwrap(), - "--eval", - EMACS_UPGRADE, - ]).spawn()? + .args(&["--batch", "-l", init_file.to_str().unwrap(), "--eval", EMACS_UPGRADE]) + .spawn()? .wait()? .check()?; @@ -126,11 +105,7 @@ pub fn run_apm(terminal: &mut Terminal, dry_run: bool) -> Option<(&'static str, } #[must_use] -pub fn run_rustup( - base_dirs: &BaseDirs, - terminal: &mut Terminal, - dry_run: bool, -) -> Option<(&'static str, bool)> { +pub fn run_rustup(base_dirs: &BaseDirs, terminal: &mut Terminal, dry_run: bool) -> Option<(&'static str, bool)> { if let Some(rustup) = utils::which("rustup") { terminal.print_separator("rustup"); @@ -143,11 +118,7 @@ pub fn run_rustup( .check()?; } - Executor::new(&rustup, dry_run) - .arg("update") - .spawn()? - .wait()? - .check()?; + Executor::new(&rustup, dry_run).arg("update").spawn()?.wait()?.check()?; Ok(()) }().is_ok(); @@ -163,16 +134,8 @@ pub fn run_opam_update(terminal: &mut Terminal, dry_run: bool) -> Option<(&'stat terminal.print_separator("OCaml Package Manager"); let success = || -> Result<(), Error> { - Executor::new(&opam, dry_run) - .arg("update") - .spawn()? - .wait()? - .check()?; - Executor::new(&opam, dry_run) - .arg("upgrade") - .spawn()? - .wait()? - .check()?; + Executor::new(&opam, dry_run).arg("update").spawn()?.wait()?.check()?; + Executor::new(&opam, dry_run).arg("upgrade").spawn()?.wait()?.check()?; Ok(()) }().is_ok(); @@ -183,12 +146,7 @@ pub fn run_opam_update(terminal: &mut Terminal, dry_run: bool) -> Option<(&'stat } #[must_use] -pub fn run_custom_command( - name: &str, - command: &str, - terminal: &mut Terminal, - dry_run: bool, -) -> Result<(), Error> { +pub fn run_custom_command(name: &str, command: &str, terminal: &mut Terminal, dry_run: bool) -> Result<(), Error> { terminal.print_separator(name); Executor::new("sh", dry_run) .arg("-c")