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%
|
- rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION%
|
||||||
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
|
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
|
||||||
- rustup component add rustfmt-preview clippy-preview
|
- rustup component add rustfmt-preview clippy-preview
|
||||||
# - cargo fmt --all -- --check
|
- cargo fmt --all -- --check
|
||||||
- cargo clippy --all-targets --all-features -- -D warnings
|
- cargo clippy --all-targets --all-features -- -D warnings
|
||||||
- rustc -Vv
|
- rustc -Vv
|
||||||
- cargo -V
|
- cargo -V
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ set -ex
|
|||||||
|
|
||||||
# TODO This is the "test phase", tweak it as you see fit
|
# TODO This is the "test phase", tweak it as you see fit
|
||||||
main() {
|
main() {
|
||||||
# cargo fmt --all -- --check
|
cargo fmt --all -- --check
|
||||||
cargo clippy --all-targets --all-features -- -D warnings
|
cargo clippy --all-targets --all-features -- -D warnings
|
||||||
cross check --target $TARGET
|
cross check --target $TARGET
|
||||||
cross check --target $TARGET --release
|
cross check --target $TARGET --release
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ pub fn upgrade_freebsd(sudo: &Option<PathBuf>, dry_run: bool) -> Option<(&'stati
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
Some(("FreeBSD Update", success))
|
Some(("FreeBSD Update", success))
|
||||||
} else {
|
} else {
|
||||||
@@ -38,7 +39,8 @@ pub fn upgrade_packages(sudo: &Option<PathBuf>, dry_run: bool) -> Option<(&'stat
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
Some(("FreeBSD Packages", success))
|
Some(("FreeBSD Packages", success))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ pub fn run_cargo_update(dry_run: bool) -> Option<(&'static str, bool)> {
|
|||||||
.check()?;
|
.check()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Cargo", success));
|
return Some(("Cargo", success));
|
||||||
}
|
}
|
||||||
@@ -43,7 +44,8 @@ pub fn run_gem(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, boo
|
|||||||
.check()?;
|
.check()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("RubyGems", success));
|
return Some(("RubyGems", success));
|
||||||
}
|
}
|
||||||
@@ -65,7 +67,8 @@ pub fn run_emacs(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, b
|
|||||||
.check()?;
|
.check()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Emacs", success));
|
return Some(("Emacs", success));
|
||||||
}
|
}
|
||||||
@@ -92,7 +95,8 @@ pub fn run_apm(dry_run: bool) -> Option<(&'static str, bool)> {
|
|||||||
.check()?;
|
.check()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("apm", success));
|
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()?;
|
Executor::new(&rustup, dry_run).arg("update").spawn()?.wait()?.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("rustup", success));
|
return Some(("rustup", success));
|
||||||
}
|
}
|
||||||
@@ -136,7 +141,8 @@ pub fn run_jetpack(dry_run: bool) -> Option<(&'static str, bool)> {
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Jetpack", success));
|
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("update").spawn()?.wait()?.check()?;
|
||||||
Executor::new(&opam, dry_run).arg("upgrade").spawn()?.wait()?.check()?;
|
Executor::new(&opam, dry_run).arg("upgrade").spawn()?.wait()?.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("OPAM", success));
|
return Some(("OPAM", success));
|
||||||
}
|
}
|
||||||
@@ -173,7 +180,8 @@ pub fn run_vcpkg_update(dry_run: bool) -> Option<(&'static str, bool)> {
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("vcpkg", success));
|
return Some(("vcpkg", success));
|
||||||
}
|
}
|
||||||
@@ -193,7 +201,8 @@ pub fn run_pipx_update(dry_run: bool) -> Option<(&'static str, bool)> {
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("pipx", success));
|
return Some(("pipx", success));
|
||||||
}
|
}
|
||||||
@@ -236,7 +245,8 @@ pub fn run_composer_update(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'sta
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Composer", success));
|
return Some(("Composer", success));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ impl Git {
|
|||||||
.check()?;
|
.check()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
Some((format!("git: {}", path.display()), success))
|
Some((format!("git: {}", path.display()), success))
|
||||||
}
|
}
|
||||||
|
|||||||
21
src/linux.rs
21
src/linux.rs
@@ -99,7 +99,8 @@ pub fn show_pacnew() {
|
|||||||
.extension()
|
.extension()
|
||||||
.filter(|ext| ext == &"pacnew" || ext == &"pacsave")
|
.filter(|ext| ext == &"pacnew" || ext == &"pacsave")
|
||||||
.is_some()
|
.is_some()
|
||||||
}).peekable();
|
})
|
||||||
|
.peekable();
|
||||||
|
|
||||||
if iter.peek().is_some() {
|
if iter.peek().is_some() {
|
||||||
println!("\nPacman backup configuration files found:");
|
println!("\nPacman backup configuration files found:");
|
||||||
@@ -269,7 +270,8 @@ pub fn run_needrestart(sudo: &Option<PathBuf>, dry_run: bool) -> Option<(&'stati
|
|||||||
.check()?;
|
.check()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Restarts", success));
|
return Some(("Restarts", success));
|
||||||
}
|
}
|
||||||
@@ -295,7 +297,8 @@ pub fn run_fwupdmgr(dry_run: bool) -> Option<(&'static str, bool)> {
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Firmware upgrade", success));
|
return Some(("Firmware upgrade", success));
|
||||||
}
|
}
|
||||||
@@ -315,7 +318,8 @@ pub fn flatpak_user_update(dry_run: bool) -> Option<(&'static str, bool)> {
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Flatpak User Packages", success));
|
return Some(("Flatpak User Packages", success));
|
||||||
}
|
}
|
||||||
@@ -336,7 +340,8 @@ pub fn flatpak_global_update(sudo: &Option<PathBuf>, dry_run: bool) -> Option<(&
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Flatpak Global Packages", success));
|
return Some(("Flatpak Global Packages", success));
|
||||||
}
|
}
|
||||||
@@ -360,7 +365,8 @@ pub fn run_snap(sudo: &Option<PathBuf>, dry_run: bool) -> Option<(&'static str,
|
|||||||
.check()?;
|
.check()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("snap", success));
|
return Some(("snap", success));
|
||||||
}
|
}
|
||||||
@@ -384,7 +390,8 @@ pub fn run_etc_update(sudo: &Option<PathBuf>, dry_run: bool) -> Option<(&'static
|
|||||||
.check()?;
|
.check()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("etc-update", success));
|
return Some(("etc-update", success));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ pub fn upgrade_macos(dry_run: bool) -> Option<(&'static str, bool)> {
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
Some(("App Store", success))
|
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_ask = !running || !no_retry;
|
||||||
let should_retry = should_ask && should_retry(running).map_err(|e| {
|
let should_retry = should_ask
|
||||||
if e.kind() == ErrorKind::Interrupted {
|
&& should_retry(running).map_err(|e| {
|
||||||
Error::from(Interrupted)
|
if e.kind() == ErrorKind::Interrupted {
|
||||||
} else {
|
Error::from(Interrupted)
|
||||||
Error::from(e)
|
} else {
|
||||||
}
|
Error::from(e)
|
||||||
})?;
|
}
|
||||||
|
})?;
|
||||||
|
|
||||||
if !should_retry {
|
if !should_retry {
|
||||||
return Ok(Some((key, success)));
|
return Ok(Some((key, success)));
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ pub fn yarn_global_update(dry_run: bool) -> Option<(&'static str, bool)> {
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("yarn", success));
|
return Some(("yarn", success));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,9 +34,11 @@ impl Terminal {
|
|||||||
message,
|
message,
|
||||||
"",
|
"",
|
||||||
border = max(2, min(80, width as usize) - 3 - message.len())
|
border = max(2, min(80, width as usize) - 3 - message.len())
|
||||||
)).bold()
|
))
|
||||||
|
.bold()
|
||||||
.white()
|
.white()
|
||||||
)).ok();
|
))
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
self.term.write_fmt(format_args!("―― {} ――\n", message)).ok();
|
self.term.write_fmt(format_args!("―― {} ――\n", message)).ok();
|
||||||
@@ -64,7 +66,8 @@ impl Terminal {
|
|||||||
} else {
|
} else {
|
||||||
style("FAILED").bold().red()
|
style("FAILED").bold().red()
|
||||||
}
|
}
|
||||||
)).ok();
|
))
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn should_retry(&mut self, running: bool) -> Result<bool, io::Error> {
|
fn should_retry(&mut self, running: bool) -> Result<bool, io::Error> {
|
||||||
@@ -82,9 +85,11 @@ impl Terminal {
|
|||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
)).yellow()
|
))
|
||||||
|
.yellow()
|
||||||
.bold()
|
.bold()
|
||||||
)).ok();
|
))
|
||||||
|
.ok();
|
||||||
|
|
||||||
let answer = loop {
|
let answer = loop {
|
||||||
match self.term.read_char()? {
|
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> {
|
let success = || -> Result<(), Error> {
|
||||||
Executor::new(&tpm, dry_run).arg("all").spawn()?.wait()?.check()?;
|
Executor::new(&tpm, dry_run).arg("all").spawn()?.wait()?.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("tmux", success));
|
return Some(("tmux", success));
|
||||||
}
|
}
|
||||||
@@ -70,7 +71,8 @@ pub fn run_in_tmux() -> ! {
|
|||||||
"set",
|
"set",
|
||||||
"remain-on-exit",
|
"remain-on-exit",
|
||||||
"on",
|
"on",
|
||||||
]).exec();
|
])
|
||||||
|
.exec();
|
||||||
|
|
||||||
panic!("{:?}", err);
|
panic!("{:?}", err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ pub fn run_zplug(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str, b
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("zplug", success));
|
return Some(("zplug", success));
|
||||||
}
|
}
|
||||||
@@ -42,7 +43,8 @@ pub fn run_fisher(base_dirs: &BaseDirs, dry_run: bool) -> Option<(&'static str,
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("fisher", success));
|
return Some(("fisher", success));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,8 @@ fn upgrade(
|
|||||||
"-e",
|
"-e",
|
||||||
"-s",
|
"-s",
|
||||||
"-V1",
|
"-V1",
|
||||||
]).spawn()?
|
])
|
||||||
|
.spawn()?
|
||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ pub fn run_chocolatey(dry_run: bool) -> Option<(&'static str, bool)> {
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Chocolatey", success));
|
return Some(("Chocolatey", success));
|
||||||
}
|
}
|
||||||
@@ -43,7 +44,8 @@ pub fn run_scoop(dry_run: bool) -> Option<(&'static str, bool)> {
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Scoop", success));
|
return Some(("Scoop", success));
|
||||||
}
|
}
|
||||||
@@ -69,7 +71,8 @@ impl Powershell {
|
|||||||
.output()?
|
.output()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok()
|
}()
|
||||||
|
.is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn profile(&self) -> Option<PathBuf> {
|
pub fn profile(&self) -> Option<PathBuf> {
|
||||||
@@ -102,7 +105,8 @@ impl Powershell {
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Powershell Modules Update", success));
|
return Some(("Powershell Modules Update", success));
|
||||||
}
|
}
|
||||||
@@ -123,7 +127,8 @@ impl Powershell {
|
|||||||
.wait()?
|
.wait()?
|
||||||
.check()?;
|
.check()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().is_ok();
|
}()
|
||||||
|
.is_ok();
|
||||||
|
|
||||||
return Some(("Windows Update", success));
|
return Some(("Windows Update", success));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user