Skip to content

Commit 0b06e92

Browse files
fix: cargo clippy errors
1 parent 80d02d3 commit 0b06e92

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/bin/elasticsearch_exporter.rs

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub fn panic_hook() {
8080
mod cli;
8181
use cli::{signal_channel, Opts};
8282

83+
#[allow(clippy::needless_return)]
8384
#[tokio::main]
8485
async fn main() -> Result<(), Box<dyn std::error::Error>> {
8586
panic_hook();

src/metric/metric_type.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub enum MetricType {
2727
Null,
2828
}
2929

30-
impl<'s> TryFrom<RawMetric<'s>> for MetricType {
30+
impl TryFrom<RawMetric<'_>> for MetricType {
3131
type Error = MetricError;
3232

3333
fn try_from(metric: RawMetric) -> Result<Self, MetricError> {
@@ -158,19 +158,19 @@ impl<'s> TryFrom<RawMetric<'s>> for MetricType {
158158
// pool_size is an int - MetricType::Gauge
159159
"size" => {
160160
// parse byte unit
161-
return match parse_i64() {
161+
match parse_i64() {
162162
Ok(int) => Ok(MetricType::Gauge(int)),
163163
Err(e) => {
164164
if let Some(byte_str) = value.as_str() {
165-
return Ok(MetricType::Gauge(
165+
Ok(MetricType::Gauge(
166166
// FIX: Possible accuracy loss (Prometheus accepts up to 64 bits)
167167
Byte::from_str(byte_str).map(|b| b.as_u128()).or(Err(e))? as i64,
168-
));
168+
))
169+
} else {
170+
Err(e)
169171
}
170-
171-
Err(e)
172172
}
173-
};
173+
}
174174
}
175175

176176
// docs_per_second -> second - https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-transforms.html

src/metric/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl Metric {
3535
}
3636
}
3737

38-
impl<'s> TryFrom<RawMetric<'s>> for Metric {
38+
impl TryFrom<RawMetric<'_>> for Metric {
3939
type Error = MetricError;
4040

4141
fn try_from(metric: RawMetric) -> Result<Self, MetricError> {

0 commit comments

Comments
 (0)