diff --git a/appveyor.yml b/appveyor.yml index 101e820e..72c518a2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,7 +20,7 @@ install: - rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION% - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - rustup component add rustfmt-preview clippy-preview - # - cargo fmt --all -- --check + - cargo fmt --all -- --check - cargo clippy --all-targets --all-features -- -D warnings - rustc -Vv - cargo -V diff --git a/ci/script.sh b/ci/script.sh index 54079325..db416121 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -4,7 +4,7 @@ set -ex # TODO This is the "test phase", tweak it as you see fit main() { - # cargo fmt --all -- --check + cargo fmt --all -- --check cargo clippy --all-targets --all-features -- -D warnings cross check --target $TARGET cross check --target $TARGET --release diff --git a/src/freebsd.rs b/src/freebsd.rs index cabfe5de..fa2660e1 100644 --- a/src/freebsd.rs +++ b/src/freebsd.rs @@ -17,7 +17,8 @@ pub fn upgrade_freebsd(sudo: &Option, dry_run: bool) -> Option<(&'stati .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); Some(("FreeBSD Update", success)) } else { @@ -38,7 +39,8 @@ pub fn upgrade_packages(sudo: &Option, dry_run: bool) -> Option<(&'stat .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); Some(("FreeBSD Packages", success)) } else { diff --git a/src/generic.rs b/src/generic.rs index 3a08104a..47173e29 100644 --- a/src/generic.rs +++ b/src/generic.rs @@ -21,7 +21,8 @@ pub fn run_cargo_update(dry_run: bool) -> Option<(&'static str, bool)> { .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Cargo", success)); } @@ -43,7 +44,8 @@ pub fn run_gem(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, boo .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("RubyGems", success)); } @@ -65,7 +67,8 @@ pub fn run_emacs(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, b .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Emacs", success)); } @@ -92,7 +95,8 @@ pub fn run_apm(dry_run: bool) -> Option<(&'static str, bool)> { .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("apm", success)); } @@ -116,7 +120,8 @@ pub fn run_rustup(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, Executor::new(&rustup, dry_run).arg("update").spawn()?.wait()?.check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("rustup", success)); } @@ -136,7 +141,8 @@ pub fn run_jetpack(dry_run: bool) -> Option<(&'static str, bool)> { .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Jetpack", success)); } @@ -153,7 +159,8 @@ pub fn run_opam_update(dry_run: bool) -> Option<(&'static str, bool)> { Executor::new(&opam, dry_run).arg("update").spawn()?.wait()?.check()?; Executor::new(&opam, dry_run).arg("upgrade").spawn()?.wait()?.check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("OPAM", success)); } @@ -173,7 +180,8 @@ pub fn run_vcpkg_update(dry_run: bool) -> Option<(&'static str, bool)> { .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("vcpkg", success)); } @@ -193,7 +201,8 @@ pub fn run_pipx_update(dry_run: bool) -> Option<(&'static str, bool)> { .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("pipx", success)); } @@ -236,7 +245,8 @@ pub fn run_composer_update(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'sta .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Composer", success)); } diff --git a/src/git.rs b/src/git.rs index a167ad28..40d8132d 100644 --- a/src/git.rs +++ b/src/git.rs @@ -81,7 +81,8 @@ impl Git { .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); Some((format!("git: {}", path.display()), success)) } diff --git a/src/linux.rs b/src/linux.rs index 204b150a..bd2a265c 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -99,7 +99,8 @@ pub fn show_pacnew() { .extension() .filter(|ext| ext == &"pacnew" || ext == &"pacsave") .is_some() - }).peekable(); + }) + .peekable(); if iter.peek().is_some() { println!("\nPacman backup configuration files found:"); @@ -269,7 +270,8 @@ pub fn run_needrestart(sudo: &Option, dry_run: bool) -> Option<(&'stati .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Restarts", success)); } @@ -295,7 +297,8 @@ pub fn run_fwupdmgr(dry_run: bool) -> Option<(&'static str, bool)> { .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Firmware upgrade", success)); } @@ -315,7 +318,8 @@ pub fn flatpak_user_update(dry_run: bool) -> Option<(&'static str, bool)> { .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Flatpak User Packages", success)); } @@ -336,7 +340,8 @@ pub fn flatpak_global_update(sudo: &Option, dry_run: bool) -> Option<(& .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Flatpak Global Packages", success)); } @@ -360,7 +365,8 @@ pub fn run_snap(sudo: &Option, dry_run: bool) -> Option<(&'static str, .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("snap", success)); } @@ -384,7 +390,8 @@ pub fn run_etc_update(sudo: &Option, dry_run: bool) -> Option<(&'static .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("etc-update", success)); } diff --git a/src/macos.rs b/src/macos.rs index fbffd517..ef782771 100644 --- a/src/macos.rs +++ b/src/macos.rs @@ -14,7 +14,8 @@ pub fn upgrade_macos(dry_run: bool) -> Option<(&'static str, bool)> { .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); Some(("App Store", success)) } diff --git a/src/main.rs b/src/main.rs index 21b8e819..f8ff3508 100644 --- a/src/main.rs +++ b/src/main.rs @@ -83,13 +83,14 @@ where } let should_ask = !running || !no_retry; - let should_retry = should_ask && should_retry(running).map_err(|e| { - if e.kind() == ErrorKind::Interrupted { - Error::from(Interrupted) - } else { - Error::from(e) - } - })?; + let should_retry = should_ask + && should_retry(running).map_err(|e| { + if e.kind() == ErrorKind::Interrupted { + Error::from(Interrupted) + } else { + Error::from(e) + } + })?; if !should_retry { return Ok(Some((key, success))); diff --git a/src/node.rs b/src/node.rs index b1e9910b..e2ed2ee9 100644 --- a/src/node.rs +++ b/src/node.rs @@ -60,7 +60,8 @@ pub fn yarn_global_update(dry_run: bool) -> Option<(&'static str, bool)> { .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("yarn", success)); } diff --git a/src/terminal.rs b/src/terminal.rs index b3cc31cd..4e920de1 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -34,9 +34,11 @@ impl Terminal { message, "", border = max(2, min(80, width as usize) - 3 - message.len()) - )).bold() + )) + .bold() .white() - )).ok(); + )) + .ok(); } None => { self.term.write_fmt(format_args!("―― {} ――\n", message)).ok(); @@ -64,7 +66,8 @@ impl Terminal { } else { style("FAILED").bold().red() } - )).ok(); + )) + .ok(); } fn should_retry(&mut self, running: bool) -> Result { @@ -82,9 +85,11 @@ impl Terminal { } else { "" } - )).yellow() + )) + .yellow() .bold() - )).ok(); + )) + .ok(); let answer = loop { match self.term.read_char()? { diff --git a/src/tmux.rs b/src/tmux.rs index e7b07cc7..bf95f3f4 100644 --- a/src/tmux.rs +++ b/src/tmux.rs @@ -21,7 +21,8 @@ pub fn run_tpm(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, boo let success = || -> Result<(), Error> { Executor::new(&tpm, dry_run).arg("all").spawn()?.wait()?.check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("tmux", success)); } @@ -70,7 +71,8 @@ pub fn run_in_tmux() -> ! { "set", "remain-on-exit", "on", - ]).exec(); + ]) + .exec(); panic!("{:?}", err); } diff --git a/src/unix.rs b/src/unix.rs index 572a4a21..501a15b5 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -16,7 +16,8 @@ pub fn run_zplug(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, b .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("zplug", success)); } @@ -42,7 +43,8 @@ pub fn run_fisher(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("fisher", success)); } diff --git a/src/vim.rs b/src/vim.rs index 4e63c811..da0d4e6b 100644 --- a/src/vim.rs +++ b/src/vim.rs @@ -72,7 +72,8 @@ fn upgrade( "-e", "-s", "-V1", - ]).spawn()? + ]) + .spawn()? .wait()? .check()?; diff --git a/src/windows.rs b/src/windows.rs index c5338fb3..946dba33 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -18,7 +18,8 @@ pub fn run_chocolatey(dry_run: bool) -> Option<(&'static str, bool)> { .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Chocolatey", success)); } @@ -43,7 +44,8 @@ pub fn run_scoop(dry_run: bool) -> Option<(&'static str, bool)> { .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Scoop", success)); } @@ -69,7 +71,8 @@ impl Powershell { .output()? .check()?; Ok(()) - }().is_ok() + }() + .is_ok() } pub fn profile(&self) -> Option { @@ -102,7 +105,8 @@ impl Powershell { .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Powershell Modules Update", success)); } @@ -123,7 +127,8 @@ impl Powershell { .wait()? .check()?; Ok(()) - }().is_ok(); + }() + .is_ok(); return Some(("Windows Update", success)); }