From f97c6331ba7ccff7e92a0e21d07a688eba2e254e Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Fri, 5 Dec 2025 01:45:10 -0700 Subject: [PATCH] cargo fmt --- signal-gateway/src/gateway/mod.rs | 20 +++++++++++++------- signal-gateway/src/lib.rs | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/signal-gateway/src/gateway/mod.rs b/signal-gateway/src/gateway/mod.rs index 1dbac71..8d1463b 100644 --- a/signal-gateway/src/gateway/mod.rs +++ b/signal-gateway/src/gateway/mod.rs @@ -3,13 +3,13 @@ use crate::{ jsonrpc::{Envelope, RpcClient, RpcClientError, SignalMessage, connect_tcp}, prometheus::{Prometheus, PrometheusConfig}, }; -use tokio_util::bytes::Buf; use conf::{Conf, Subcommands}; use futures_util::FutureExt; use http::{Method, Request, Response, StatusCode}; use http_body::Body; use http_body_util::BodyExt; use prometheus_http_client::{AlertStatus, ExtractLabels}; +use tokio_util::bytes::Buf; //use jsonrpsee::async_client::{Client as JsonRpcClient, Error as JsonRpcError}; use chrono::Utc; use std::{ @@ -419,15 +419,21 @@ impl Gateway { match req.uri().path() { "/" | "/health" | "/ready" => { - if !matches!(req.method(), Method::GET | Method::HEAD) { - Ok(err_resp(StatusCode::UNIMPLEMENTED, "Use GET or HEAD with this route")) + if !matches!(req.method(), &Method::GET | &Method::HEAD) { + Ok(err_resp( + StatusCode::NOT_IMPLEMENTED, + "Use GET or HEAD with this route", + )) } else { Ok(ok_resp()) } - }, + } "/alert" => { - if !matches!(req.method(), Method::POST) { - return Ok(err_resp(StatusCode::UNIMPLEMENTED, "Use POST with this route")); + if !matches!(req.method(), &Method::POST) { + return Ok(err_resp( + StatusCode::NOT_IMPLEMENTED, + "Use POST with this route", + )); } let v = req .into_body() @@ -442,7 +448,7 @@ impl Gateway { } else { Ok(ok_resp()) } - }, + } _ => Ok(err_resp( StatusCode::NOT_FOUND, format!("Not found '{} {}'", req.method(), req.uri().path()), diff --git a/signal-gateway/src/lib.rs b/signal-gateway/src/lib.rs index 3f5acf2..d7a01cc 100644 --- a/signal-gateway/src/lib.rs +++ b/signal-gateway/src/lib.rs @@ -1,8 +1,8 @@ pub mod alertmanager; pub mod gateway; -pub(crate) mod jsonrpc; pub(crate) mod human_duration; +pub(crate) mod jsonrpc; pub(crate) mod prometheus; pub(crate) mod transports;