From f57e5575785ab446a92fd05379e596954b8069eb Mon Sep 17 00:00:00 2001 From: Daniele Guarascio Date: Mon, 4 Jul 2022 12:04:51 +0200 Subject: [PATCH] Reduce chrono features --- Cargo.toml | 2 +- src/lib.rs | 2 +- src/metrics.rs | 36 ++++++++++++++++++------------------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cd3bb02e..6da5466d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/mcasper/dogstatsd-rs" keywords = ["datadog", "dogstatsd", "client"] [dependencies] -chrono = "0.4" +chrono = { version = "0.4", optional = true, default-features = false, features = ["clock"] } [features] unstable = [] diff --git a/src/lib.rs b/src/lib.rs index 8c9370ab..c00764a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -153,7 +153,7 @@ impl Options { from_addr: from_addr.into(), to_addr: to_addr.into(), namespace: namespace.into(), - default_tags: default_tags + default_tags } } } diff --git a/src/metrics.rs b/src/metrics.rs index 0a2dc9ee..abf43dc2 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -114,9 +114,9 @@ impl<'a> Metric for TimeMetric<'a> { impl<'a> TimeMetric<'a> { pub fn new(stat: &'a str, start_time: &'a DateTime, end_time: &'a DateTime) -> Self { TimeMetric { - start_time: start_time, - end_time: end_time, - stat: stat, + start_time, + end_time, + stat, } } } @@ -142,8 +142,8 @@ impl<'a> Metric for TimingMetric<'a> { impl<'a> TimingMetric<'a> { pub fn new(stat: &'a str, ms: i64) -> Self { TimingMetric { - ms: ms, - stat: stat, + ms, + stat, } } } @@ -168,8 +168,8 @@ impl<'a> Metric for GaugeMetric<'a> { impl<'a> GaugeMetric<'a> { pub fn new(stat: &'a str, val: &'a str) -> Self { GaugeMetric { - stat: stat, - val: val, + stat, + val, } } } @@ -194,8 +194,8 @@ impl<'a> Metric for HistogramMetric<'a> { impl<'a> HistogramMetric<'a> { pub fn new(stat: &'a str, val: &'a str) -> Self { HistogramMetric { - stat: stat, - val: val, + stat, + val, } } } @@ -220,8 +220,8 @@ impl<'a>Metric for DistributionMetric<'a> { impl<'a> DistributionMetric<'a> { pub fn new(stat: &'a str, val: &'a str) -> Self { DistributionMetric { - stat: stat, - val: val, + stat, + val, } } } @@ -246,8 +246,8 @@ impl<'a> Metric for SetMetric<'a> { impl<'a> SetMetric<'a> { pub fn new(stat: &'a str, val: &'a str) -> Self { SetMetric { - stat: stat, - val: val, + stat, + val, } } } @@ -348,9 +348,9 @@ impl<'a> Metric for ServiceCheck<'a> { impl<'a> ServiceCheck<'a> { pub fn new(stat: &'a str, val: ServiceStatus, options: ServiceCheckOptions) -> Self { ServiceCheck { - stat: stat, - val: val, - options: options, + stat, + val, + options, } } } @@ -384,8 +384,8 @@ impl<'a> Metric for Event<'a> { impl<'a> Event<'a> { pub fn new(title: &'a str, text: &'a str) -> Self { Event { - title: title, - text: text, + title, + text, } } }