mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
Update Rust Edition to 2024 (#7766)
* #7749 Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
@@ -55,10 +55,9 @@ use std::time::Duration;
|
||||
|
||||
use prometheus::core::{Atomic, GenericGauge, GenericGaugeVec};
|
||||
pub use prometheus::{
|
||||
exponential_buckets, linear_buckets,
|
||||
DEFAULT_BUCKETS, Encoder, Gauge, GaugeVec, Histogram, HistogramTimer, HistogramVec, IntCounter,
|
||||
IntCounterVec, IntGauge, IntGaugeVec, Result, TextEncoder, exponential_buckets, linear_buckets,
|
||||
proto::{Metric, MetricFamily, MetricType},
|
||||
Encoder, Gauge, GaugeVec, Histogram, HistogramTimer, HistogramVec, IntCounter, IntCounterVec,
|
||||
IntGauge, IntGaugeVec, Result, TextEncoder, DEFAULT_BUCKETS,
|
||||
};
|
||||
|
||||
/// Collect all the metrics for reporting.
|
||||
@@ -423,10 +422,10 @@ pub trait TryExt {
|
||||
|
||||
impl<T, E> TryExt for std::result::Result<T, E> {
|
||||
fn discard_timer_on_break(self, timer_opt: &mut Option<HistogramTimer>) -> Self {
|
||||
if self.is_err() {
|
||||
if let Some(timer) = timer_opt.take() {
|
||||
timer.stop_and_discard();
|
||||
}
|
||||
if self.is_err()
|
||||
&& let Some(timer) = timer_opt.take()
|
||||
{
|
||||
timer.stop_and_discard();
|
||||
}
|
||||
self
|
||||
}
|
||||
@@ -434,10 +433,10 @@ impl<T, E> TryExt for std::result::Result<T, E> {
|
||||
|
||||
impl<T> TryExt for Option<T> {
|
||||
fn discard_timer_on_break(self, timer_opt: &mut Option<HistogramTimer>) -> Self {
|
||||
if self.is_none() {
|
||||
if let Some(timer) = timer_opt.take() {
|
||||
timer.stop_and_discard();
|
||||
}
|
||||
if self.is_none()
|
||||
&& let Some(timer) = timer_opt.take()
|
||||
{
|
||||
timer.stop_and_discard();
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user