From 69e6674064c08630b7b397a58d6e99279d8d98ce Mon Sep 17 00:00:00 2001 From: Doehyun Baek Date: Wed, 1 Jun 2022 19:24:22 +0900 Subject: [PATCH] */Cargo.toml: Update to 2021 edition (#65) As suggested in https://github.com/prometheus/client_rust/issues/64, this commit update edition key of manifest file into 2021. As documented in 2021 edition guide(https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html), array.into_iter() now returns owned value instead of references, This commit changes previous doc comments to utilize new behavior. Signed-off-by: Doehyun Baek --- CHANGELOG.md | 8 ++++++++ Cargo.toml | 6 +++--- derive-text-encode/Cargo.toml | 4 ++-- src/metrics/family.rs | 4 ++-- src/metrics/histogram.rs | 5 +++-- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05bdffc5..7c9bb82a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.17.0] - unreleased + +### Changed + +- Updates to Rust 2021 Edition. See [PR 65]. + +[PR 65]: https://github.com/prometheus/client_rust/pull/65 + ## [0.16.0] ### Changed diff --git a/Cargo.toml b/Cargo.toml index f02dc750..6808a572 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "prometheus-client" -version = "0.16.0" +version = "0.17.0" authors = ["Max Inden "] -edition = "2018" +edition = "2021" description = "Open Metrics client library allowing users to natively instrument applications." license = "Apache-2.0 OR MIT" keywords = ["openmetrics", "prometheus", "metrics", "instrumentation", "monitoring"] @@ -17,7 +17,7 @@ members = ["derive-text-encode"] dtoa = "1.0" itoa = "1.0" owning_ref = "0.4" -prometheus-client-derive-text-encode = { version = "0.2.0", path = "derive-text-encode" } +prometheus-client-derive-text-encode = { version = "0.3.0", path = "derive-text-encode" } [dev-dependencies] async-std = { version = "1", features = ["attributes"] } diff --git a/derive-text-encode/Cargo.toml b/derive-text-encode/Cargo.toml index 8bb06f1d..f243c24e 100644 --- a/derive-text-encode/Cargo.toml +++ b/derive-text-encode/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "prometheus-client-derive-text-encode" -version = "0.2.0" +version = "0.3.0" authors = ["Max Inden "] -edition = "2018" +edition = "2021" description = "Auxiliary crate to derive text Encode trait from prometheus-client." license = "Apache-2.0 OR MIT" repository = "https://github.com/prometheus/client_rust" diff --git a/src/metrics/family.rs b/src/metrics/family.rs index 7d5d0e59..1610881b 100644 --- a/src/metrics/family.rs +++ b/src/metrics/family.rs @@ -144,9 +144,9 @@ pub trait MetricConstructor { /// ``` /// # use prometheus_client::metrics::family::{Family}; /// # use prometheus_client::metrics::histogram::Histogram; -/// let custom_buckets = vec![0.0, 10.0, 100.0]; +/// let custom_buckets = [0.0, 10.0, 100.0]; /// let metric = Family::<(), Histogram, _>::new_with_constructor(|| { -/// Histogram::new(custom_buckets.clone().into_iter()) +/// Histogram::new(custom_buckets.into_iter()) /// }); /// # metric.get_or_create(&()); /// ``` diff --git a/src/metrics/histogram.rs b/src/metrics/histogram.rs index e17799cf..3f2ae9ff 100644 --- a/src/metrics/histogram.rs +++ b/src/metrics/histogram.rs @@ -23,9 +23,10 @@ use std::sync::{Arc, Mutex, MutexGuard}; /// ``` /// # use prometheus_client::metrics::histogram::Histogram; /// // Default values from go client(https://github.com/prometheus/client_golang/blob/5d584e2717ef525673736d72cd1d12e304f243d7/prometheus/histogram.go#L68) -/// let histogram = Histogram::new(IntoIterator::into_iter([ +/// let custom_buckets = [ /// 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0, -/// ])); +/// ]; +/// let histogram = Histogram::new(custom_buckets.into_iter()); /// histogram.observe(4.2); /// ``` // TODO: Consider using atomics. See