From b8987f6eebeac8cc09fb21b9e02405f0c78eecd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sat, 3 Jun 2023 02:15:24 +0200 Subject: [PATCH] rustfmt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- src/webhook.rs | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/src/webhook.rs b/src/webhook.rs index 8753822..53b27e1 100644 --- a/src/webhook.rs +++ b/src/webhook.rs @@ -19,31 +19,29 @@ use log::debug; pub fn format_webhook(wh: &WebHook) -> Option { Some(match wh { WebHook::Push(push) => { - if push.commits.len() != 0 { - let mut text = format!( - "[{}] {} pushed {} commits branch {}", - push.project.name, - push.user_name, - push.commits.len(), - push.ref_, - ); - for commit in &push.commits { - match commit.message.lines().nth(0) { - Some(subject) => { - text = format!("{}\n• {} <{}>", text, subject, commit.url); - } - None => {} - } - } - text - } else { - format!( - "[{}] {} deleted branch {}", - push.project.name, - push.user_name, - push.ref_, - ) - } + if push.commits.len() != 0 { + let mut text = format!( + "[{}] {} pushed {} commits branch {}", + push.project.name, + push.user_name, + push.commits.len(), + push.ref_, + ); + for commit in &push.commits { + match commit.message.lines().nth(0) { + Some(subject) => { + text = format!("{}\n• {} <{}>", text, subject, commit.url); + } + None => {} + } + } + text + } else { + format!( + "[{}] {} deleted branch {}", + push.project.name, push.user_name, push.ref_, + ) + } } WebHook::Issue(issue) => { let action = match issue.object_attributes.action {