Skip to content

Commit 416bab7

Browse files
committed
chore: remove redundant .into() calls in lib.rs to fix Clippy warnings
- Eliminated unnecessary `.into()` type conversions in `lib.rs` to address Clippy's `useless conversion` warnings. - Improved code clarity and ensured compliance with Rust best practices. - Verified changes with `cargo clippy` to confirm no new warnings or errors.
1 parent 33b854e commit 416bab7

File tree

1 file changed

+11
-11
lines changed
  • opentelemetry-prometheus/src

1 file changed

+11
-11
lines changed

opentelemetry-prometheus/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -491,16 +491,16 @@ fn add_histogram_metric<T: Numeric>(
491491
let mut h = prometheus::proto::Histogram::default();
492492
h.set_sample_sum(dp.sum.as_f64());
493493
h.set_sample_count(dp.count);
494-
h.set_bucket(bucket.into());
494+
h.set_bucket(bucket);
495495
let mut pm = prometheus::proto::Metric::default();
496-
pm.set_label(kvs.into());
496+
pm.set_label(kvs);
497497
pm.set_histogram(h);
498498

499499
let mut mf = prometheus::proto::MetricFamily::default();
500500
mf.set_name(name.to_string());
501501
mf.set_help(description.clone());
502502
mf.set_field_type(prometheus::proto::MetricType::HISTOGRAM);
503-
mf.set_metric(vec![pm].into());
503+
mf.set_metric(vec![pm]);
504504
res.push(mf);
505505
}
506506
}
@@ -525,7 +525,7 @@ fn add_sum_metric<T: Numeric>(
525525
);
526526

527527
let mut pm = prometheus::proto::Metric::default();
528-
pm.set_label(kvs.into());
528+
pm.set_label(kvs);
529529

530530
if sum.is_monotonic {
531531
let mut c = prometheus::proto::Counter::default();
@@ -541,7 +541,7 @@ fn add_sum_metric<T: Numeric>(
541541
mf.set_name(name.to_string());
542542
mf.set_help(description.clone());
543543
mf.set_field_type(metric_type);
544-
mf.set_metric(vec![pm].into());
544+
mf.set_metric(vec![pm]);
545545
res.push(mf);
546546
}
547547
}
@@ -562,14 +562,14 @@ fn add_gauge_metric<T: Numeric>(
562562
let mut g = prometheus::proto::Gauge::default();
563563
g.set_value(dp.value.as_f64());
564564
let mut pm = prometheus::proto::Metric::default();
565-
pm.set_label(kvs.into());
565+
pm.set_label(kvs);
566566
pm.set_gauge(g);
567567

568568
let mut mf = prometheus::proto::MetricFamily::default();
569569
mf.set_name(name.to_string());
570570
mf.set_help(description.to_string());
571571
mf.set_field_type(MetricType::GAUGE);
572-
mf.set_metric(vec![pm].into());
572+
mf.set_metric(vec![pm]);
573573
res.push(mf);
574574
}
575575
}
@@ -586,14 +586,14 @@ fn create_info_metric(
586586
m.set_label(get_attrs(
587587
&mut resource.iter(),
588588
&[],
589-
).into());
589+
));
590590
m.set_gauge(g);
591591

592592
let mut mf = MetricFamily::default();
593593
mf.set_name(target_info_name.into());
594594
mf.set_help(target_info_description.into());
595595
mf.set_field_type(MetricType::GAUGE);
596-
mf.set_metric(vec![m].into());
596+
mf.set_metric(vec![m]);
597597
mf
598598
}
599599

@@ -614,14 +614,14 @@ fn create_scope_info_metric(scope: &InstrumentationScope) -> MetricFamily {
614614
}
615615

616616
let mut m = prometheus::proto::Metric::default();
617-
m.set_label(labels.into());
617+
m.set_label(labels);
618618
m.set_gauge(g);
619619

620620
let mut mf = MetricFamily::default();
621621
mf.set_name(SCOPE_INFO_METRIC_NAME.into());
622622
mf.set_help(SCOPE_INFO_DESCRIPTION.into());
623623
mf.set_field_type(MetricType::GAUGE);
624-
mf.set_metric(vec![m].into());
624+
mf.set_metric(vec![m]);
625625
mf
626626
}
627627

0 commit comments

Comments
 (0)