Make clippy happy
This commit is contained in:
@@ -229,7 +229,7 @@ impl CommandExt for Command {
|
||||
trace!("Output of {:?}: {:?}", self, output);
|
||||
let status = output.status;
|
||||
if !status.success() {
|
||||
Err(ErrorKind::ProcessFailed(status))?
|
||||
return Err(ErrorKind::ProcessFailed(status).into());
|
||||
}
|
||||
Ok(String::from_utf8(output.stdout).context(ErrorKind::ProcessExecution)?)
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ pub fn run_composer_update(base_dirs: &BaseDirs, run_type: RunType) -> Result<()
|
||||
.and_then(PathExt::require)?;
|
||||
|
||||
if !composer_home.is_descendant_of(base_dirs.home_dir()) {
|
||||
Err(ErrorKind::SkipStep)?;
|
||||
return Err(ErrorKind::SkipStep.into());
|
||||
}
|
||||
|
||||
print_separator("Composer");
|
||||
@@ -149,9 +149,10 @@ pub fn run_remote_topgrade(
|
||||
#[cfg(unix)]
|
||||
{
|
||||
crate::tmux::run_remote_topgrade(hostname, &ssh)?;
|
||||
Err(ErrorKind::SkipStep)?
|
||||
Err(ErrorKind::SkipStep.into())
|
||||
}
|
||||
|
||||
#[cfg(not(unix))]
|
||||
unreachable!("Tmux execution is only implemented in Unix");
|
||||
} else {
|
||||
let mut args = vec!["-t", hostname];
|
||||
|
||||
@@ -121,29 +121,28 @@ impl Git {
|
||||
if output.status.success() {
|
||||
let after_revision = get_head_revision(&cloned_git, &repo);
|
||||
|
||||
if before_revision != after_revision
|
||||
&& after_revision.is_some()
|
||||
&& before_revision.is_some()
|
||||
{
|
||||
println!("{} {}:", style("Changed").yellow().bold(), path);
|
||||
Command::new(&cloned_git)
|
||||
.current_dir(&repo)
|
||||
.args(&[
|
||||
"--no-pager",
|
||||
"log",
|
||||
"--no-decorate",
|
||||
"--oneline",
|
||||
&format!("{}..{}", before_revision.unwrap(), after_revision.unwrap()),
|
||||
])
|
||||
.spawn()
|
||||
.unwrap()
|
||||
.wait()
|
||||
.unwrap();
|
||||
println!();
|
||||
} else {
|
||||
println!("{} {}", style("Up-to-date").green().bold(), path);
|
||||
match (&before_revision, &after_revision) {
|
||||
(Some(before), Some(after)) if before != after => {
|
||||
println!("{} {}:", style("Changed").yellow().bold(), path);
|
||||
Command::new(&cloned_git)
|
||||
.current_dir(&repo)
|
||||
.args(&[
|
||||
"--no-pager",
|
||||
"log",
|
||||
"--no-decorate",
|
||||
"--oneline",
|
||||
&format!("{}..{}", before, after),
|
||||
])
|
||||
.spawn()
|
||||
.unwrap()
|
||||
.wait()
|
||||
.unwrap();
|
||||
println!();
|
||||
}
|
||||
_ => {
|
||||
println!("{} {}", style("Up-to-date").green().bold(), path);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(true) as Result<bool, Error>
|
||||
} else {
|
||||
println!("{} pulling {}", style("Failed").red().bold(), path);
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn run_npm_upgrade(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Er
|
||||
let npm = require("npm").map(NPM::new)?;
|
||||
let npm_root = npm.root()?;
|
||||
if !npm_root.is_descendant_of(base_dirs.home_dir()) {
|
||||
Err(ErrorKind::SkipStep)?;
|
||||
return Err(ErrorKind::SkipStep.into());
|
||||
}
|
||||
|
||||
print_separator("Node Package Manager");
|
||||
|
||||
@@ -83,7 +83,7 @@ fn upgrade(vim: &PathBuf, vimrc: &PathBuf, plugin_framework: PluginFramework, ru
|
||||
if !status.success() {
|
||||
io::stdout().write(&output.stdout).ok();
|
||||
io::stderr().write(&output.stderr).ok();
|
||||
Err(ErrorKind::ProcessFailed(status))?
|
||||
return Err(ErrorKind::ProcessFailed(status).into());
|
||||
} else {
|
||||
println!("Plugins upgraded")
|
||||
}
|
||||
@@ -98,7 +98,7 @@ pub fn upgrade_vim(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Error>
|
||||
|
||||
let output = Command::new(&vim).arg("--version").check_output()?;
|
||||
if !output.starts_with("VIM") {
|
||||
Err(ErrorKind::SkipStep)?;
|
||||
return Err(ErrorKind::SkipStep.into());
|
||||
}
|
||||
|
||||
let vimrc = require_option(vimrc(&base_dirs))?;
|
||||
|
||||
@@ -16,7 +16,7 @@ impl Check for ExitStatus {
|
||||
if self.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(ErrorKind::ProcessFailed(self))?
|
||||
Err(ErrorKind::ProcessFailed(self).into())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ impl PathExt for PathBuf {
|
||||
if self.exists() {
|
||||
Ok(self)
|
||||
} else {
|
||||
Err(ErrorKind::SkipStep)?
|
||||
Err(ErrorKind::SkipStep.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,7 +182,7 @@ pub fn require<T: AsRef<OsStr> + Debug>(binary_name: T) -> Result<PathBuf, Error
|
||||
Err(e) => match e.kind() {
|
||||
which_crate::ErrorKind::CannotFindBinaryPath => {
|
||||
debug!("Cannot find {:?}", &binary_name);
|
||||
Err(ErrorKind::SkipStep)?
|
||||
Err(ErrorKind::SkipStep.into())
|
||||
}
|
||||
_ => {
|
||||
panic!("Detecting {:?} failed: {}", &binary_name, e);
|
||||
@@ -196,6 +196,6 @@ pub fn require_option<T>(option: Option<T>) -> Result<T, Error> {
|
||||
if let Some(value) = option {
|
||||
Ok(value)
|
||||
} else {
|
||||
Err(ErrorKind::SkipStep)?
|
||||
Err(ErrorKind::SkipStep.into())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user