diff options
author | edef <edef@unfathomable.blue> | 2022-06-20 11:25:51 +0000 |
---|---|---|
committer | edef <edef@unfathomable.blue> | 2022-06-20 11:25:51 +0000 |
commit | dddd01d2d5636aa8ca8aceb3581595be6fa000c2 (patch) | |
tree | dc8c2062ff7186d9db164b431089be527b5c78c0 /fleet/pkgs/naut/src | |
parent | 56e049eb6a65da72b09c6e94c5f743dac652e3c7 (diff) | |
download | unf-legacy-dddd01d2d5636aa8ca8aceb3581595be6fa000c2.tar.zst |
fleet/pkgs/naut: clean up formatting
Change-Id: I74844b6a35fe1fd76af87fe994a346ee92eb3ccb
Diffstat (limited to 'fleet/pkgs/naut/src')
-rw-r--r-- | fleet/pkgs/naut/src/main.rs | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/fleet/pkgs/naut/src/main.rs b/fleet/pkgs/naut/src/main.rs index 361c212..ed38a96 100644 --- a/fleet/pkgs/naut/src/main.rs +++ b/fleet/pkgs/naut/src/main.rs @@ -42,7 +42,7 @@ async fn main() -> Result<()> { spawn(async move { if let Err(e) = conn.await { - eprintln!("Failed to handle request: {}", e); + eprintln!("Failed to handle request: {e}"); } }); } @@ -115,14 +115,14 @@ async fn handle( if r#ref.is_branch() { if new.is_zero() { - lines.push(format!("branch {} deleted (was {})", ref_name, old)); + lines.push(format!("branch {ref_name} deleted (was {old})")); } else { let mut walker = repo.revwalk()?; walker.set_sorting(Sort::REVERSE)?; walker.push(new)?; if old.is_zero() { - lines.push(format!("new branch created: {}", ref_name)); + lines.push(format!("new branch created: {ref_name}")); // We cannot use repo.head directly, as that comes resolved already. let head = repo.find_reference("HEAD")?; @@ -157,14 +157,13 @@ async fn handle( if !commits.is_empty() { lines.push(format!( - "{} {} pushed to {}", + "{} {} pushed to {ref_name}", commits.len(), if commits.len() == 1 { "commit" } else { "commits" }, - ref_name )); for commit in commits { @@ -178,16 +177,13 @@ async fn handle( } } } else if r#ref.is_tag() { - if new.is_zero() { - lines.push(format!("tag {} deleted (was {})", ref_name, old)) + lines.push(if new.is_zero() { + format!("tag {ref_name} deleted (was {old})") } else if old.is_zero() { - lines.push(format!("commit {} tagged as {}", new, ref_name)) + format!("commit {new} tagged as {ref_name}") } else { - lines.push(format!( - "tag {} modified (was {}, now {})", - ref_name, old, new - )) - } + format!("tag {ref_name} modified (was {old}, now {new})") + }); } else { return Err(anyhow!( "Received a reference that's neither a branch nor tag: {}", |