Skip to content

Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.

fix: collapse nested if statements to satisfy clippy

FABIOTESS596be3e360c4
diff --git a/src/monitor.rs b/src/monitor.rs
index ce07292d..d7fe3515 100644
--- a/src/monitor.rs
+++ b/src/monitor.rs
@@ -89,8 +89,8 @@ impl Monitor {
self.set_blocked(true);
}
// Fire webhook for Notify actions
- if matches!(w.action, WatcherAction::Notify) {
- if let Some(ref url) = w.webhook_url {
+ if matches!(w.action, WatcherAction::Notify)
+ && let Some(ref url) = w.webhook_url {
let url = url.clone();
let headers = w.webhook_headers.clone();
let payload = serde_json::json!({
@@ -105,7 +105,6 @@ impl Monitor {
tokio::spawn(async move {
let _ = crate::webhook::deliver_webhook(&url, headers.as_deref(), &payload).await;
});
- }
}
alerts.push(Alert {
watcher: w.id.clone(),
diff --git a/src/webhook.rs b/src/webhook.rs
index 65aebca8..b7725537 100644
--- a/src/webhook.rs
+++ b/src/webhook.rs
@@ -10,12 +10,11 @@ pub async fn deliver_webhook(
.timeout(Duration::from_secs(10))
.build()?;
let mut req = client.post(url).json(payload);
- if let Some(hdr_json) = headers_json {
- if let Ok(map) = serde_json::from_str::<std::collections::HashMap<String, String>>(hdr_json) {
+ if let Some(hdr_json) = headers_json
+ && let Ok(map) = serde_json::from_str::<std::collections::HashMap<String, String>>(hdr_json) {
for (k, v) in map {
req = req.header(&k, &v);
}
- }
}
let resp = req.send().await?;
let status = resp.status();