diff --git a/Cargo.lock b/Cargo.lock index 7d244c5..030767e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -287,9 +287,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.18" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" +checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" dependencies = [ "clap_builder", "clap_derive", @@ -297,9 +297,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.18" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" +checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" dependencies = [ "anstream", "anstyle", diff --git a/Cargo.toml b/Cargo.toml index 43dccd9..86c8ccc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ version = "0.4.38" [dependencies.clap] default-features = false features = ["suggestions", "color", "derive", "std", "cargo"] -version = "4.5.18" +version = "4.5.19" [dependencies.elasticsearch] default-features = false diff --git a/src/bin/elasticsearch_exporter.rs b/src/bin/elasticsearch_exporter.rs index e3842ae..8d25f42 100644 --- a/src/bin/elasticsearch_exporter.rs +++ b/src/bin/elasticsearch_exporter.rs @@ -80,6 +80,7 @@ pub fn panic_hook() { mod cli; use cli::{signal_channel, Opts}; +#[allow(clippy::needless_return)] #[tokio::main] async fn main() -> Result<(), Box> { panic_hook(); diff --git a/src/metric/metric_type.rs b/src/metric/metric_type.rs index a72ff56..781bf00 100644 --- a/src/metric/metric_type.rs +++ b/src/metric/metric_type.rs @@ -27,7 +27,7 @@ pub enum MetricType { Null, } -impl<'s> TryFrom> for MetricType { +impl TryFrom> for MetricType { type Error = MetricError; fn try_from(metric: RawMetric) -> Result { @@ -158,19 +158,19 @@ impl<'s> TryFrom> for MetricType { // pool_size is an int - MetricType::Gauge "size" => { // parse byte unit - return match parse_i64() { + match parse_i64() { Ok(int) => Ok(MetricType::Gauge(int)), Err(e) => { if let Some(byte_str) = value.as_str() { - return Ok(MetricType::Gauge( + Ok(MetricType::Gauge( // FIX: Possible accuracy loss (Prometheus accepts up to 64 bits) Byte::from_str(byte_str).map(|b| b.as_u128()).or(Err(e))? as i64, - )); + )) + } else { + Err(e) } - - Err(e) } - }; + } } // docs_per_second -> second - https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-transforms.html diff --git a/src/metric/mod.rs b/src/metric/mod.rs index 4c3ee8a..bf562c3 100644 --- a/src/metric/mod.rs +++ b/src/metric/mod.rs @@ -35,7 +35,7 @@ impl Metric { } } -impl<'s> TryFrom> for Metric { +impl TryFrom> for Metric { type Error = MetricError; fn try_from(metric: RawMetric) -> Result {