clippy fix

This commit is contained in:
nora 2024-01-21 18:14:20 +01:00
parent 2da77e8af5
commit d0b410a6b3
4 changed files with 14 additions and 14 deletions

View file

@ -11,14 +11,14 @@ pub fn build(blog: &Path, dist: &Path) -> Result<()> {
utils::run_process( utils::run_process(
Command::new("git") Command::new("git")
.args(&["submodule", "init"]) .args(["submodule", "init"])
.current_dir(&blog), .current_dir(blog),
)?; )?;
utils::run_process( utils::run_process(
Command::new("git") Command::new("git")
.args(&["submodule", "update"]) .args(["submodule", "update"])
.current_dir(&blog), .current_dir(blog),
)?; )?;
// Patch config // Patch config
@ -29,8 +29,8 @@ pub fn build(blog: &Path, dist: &Path) -> Result<()> {
utils::run_process( utils::run_process(
Command::new("hugo") Command::new("hugo")
.args(&["--minify", "--destination", dist.to_str().unwrap()]) .args(["--minify", "--destination", dist.to_str().unwrap()])
.current_dir(&blog), .current_dir(blog),
)?; )?;
Ok(()) Ok(())

View file

@ -44,7 +44,7 @@ impl Talk {
format!( format!(
"{}-{}", "{}-{}",
self.date, self.date,
self.name.replace(" ", "-").to_lowercase() self.name.replace(' ', "-").to_lowercase()
) )
} }
} }

View file

@ -89,7 +89,7 @@ pub fn sync(path: &Path, config: &Submodules) -> color_eyre::Result<()> {
if !sub_path.exists() { if !sub_path.exists() {
info!(?name, ?url, "Cloning"); info!(?name, ?url, "Cloning");
let mut cmd = process::Command::new("git"); let mut cmd = process::Command::new("git");
cmd.args(&["clone", url, sub_path.to_str().unwrap()]); cmd.args(["clone", url, sub_path.to_str().unwrap()]);
utils::run_process(&mut cmd)?; utils::run_process(&mut cmd)?;
} else { } else {
debug!(?name, ?url, "Repo already exists"); debug!(?name, ?url, "Repo already exists");
@ -97,7 +97,7 @@ pub fn sync(path: &Path, config: &Submodules) -> color_eyre::Result<()> {
let current_commit = utils::run_process( let current_commit = utils::run_process(
process::Command::new("git") process::Command::new("git")
.args(&["rev-parse", "HEAD"]) .args(["rev-parse", "HEAD"])
.current_dir(&sub_path), .current_dir(&sub_path),
) )
.wrap_err("running git rev-parse HEAD")?; .wrap_err("running git rev-parse HEAD")?;
@ -108,19 +108,19 @@ pub fn sync(path: &Path, config: &Submodules) -> color_eyre::Result<()> {
info!("Need to change commit"); info!("Need to change commit");
let commit_exists = utils::run_process( let commit_exists = utils::run_process(
process::Command::new("git") process::Command::new("git")
.args(&["cat-file", "-t", sync.commit.as_str()]) .args(["cat-file", "-t", sync.commit.as_str()])
.current_dir(&sub_path), .current_dir(&sub_path),
); );
if !commit_exists.is_ok_and(|typ| typ == "commit\n".to_owned()) { if !commit_exists.is_ok_and(|typ| typ == *"commit\n") {
info!("Must fetch commit"); info!("Must fetch commit");
utils::run_process(process::Command::new("git").current_dir(&sub_path).args(&[ utils::run_process(process::Command::new("git").current_dir(&sub_path).args([
"fetch", "fetch",
"origin", "origin",
sync.commit.as_str(), sync.commit.as_str(),
]))?; ]))?;
} }
utils::run_process(process::Command::new("git").current_dir(&sub_path).args(&[ utils::run_process(process::Command::new("git").current_dir(&sub_path).args([
"reset", "reset",
"--hard", "--hard",
sync.commit.as_str(), sync.commit.as_str(),

View file

@ -19,7 +19,7 @@ pub fn run_process(cmd: &mut Command) -> Result<String> {
); );
} }
Ok(String::from_utf8(output.stdout).wrap_err("stdout is not UTF-8")?) String::from_utf8(output.stdout).wrap_err("stdout is not UTF-8")
} }
run_process_inner(cmd).wrap_err(format!( run_process_inner(cmd).wrap_err(format!(
"{} {}", "{} {}",