Try to restore cargo fmt
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,7 +17,8 @@ pub fn upgrade_freebsd(sudo: &Option<PathBuf>, 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<PathBuf>, dry_run: bool) -> Option<(&'stat
|
||||
.wait()?
|
||||
.check()?;
|
||||
Ok(())
|
||||
}().is_ok();
|
||||
}()
|
||||
.is_ok();
|
||||
|
||||
Some(("FreeBSD Packages", success))
|
||||
} else {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -81,7 +81,8 @@ impl Git {
|
||||
.check()?;
|
||||
|
||||
Ok(())
|
||||
}().is_ok();
|
||||
}()
|
||||
.is_ok();
|
||||
|
||||
Some((format!("git: {}", path.display()), success))
|
||||
}
|
||||
|
||||
21
src/linux.rs
21
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<PathBuf>, 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<PathBuf>, 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<PathBuf>, 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<PathBuf>, dry_run: bool) -> Option<(&'static
|
||||
.check()?;
|
||||
|
||||
Ok(())
|
||||
}().is_ok();
|
||||
}()
|
||||
.is_ok();
|
||||
|
||||
return Some(("etc-update", success));
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
15
src/main.rs
15
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)));
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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<bool, io::Error> {
|
||||
@@ -82,9 +85,11 @@ impl Terminal {
|
||||
} else {
|
||||
""
|
||||
}
|
||||
)).yellow()
|
||||
))
|
||||
.yellow()
|
||||
.bold()
|
||||
)).ok();
|
||||
))
|
||||
.ok();
|
||||
|
||||
let answer = loop {
|
||||
match self.term.read_char()? {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ fn upgrade(
|
||||
"-e",
|
||||
"-s",
|
||||
"-V1",
|
||||
]).spawn()?
|
||||
])
|
||||
.spawn()?
|
||||
.wait()?
|
||||
.check()?;
|
||||
|
||||
|
||||
@@ -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<PathBuf> {
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user