From 9d4206770dd93f07cb27c3e1f41dc21c45031302 Mon Sep 17 00:00:00 2001 From: Ashley Mannix Date: Wed, 27 Jan 2021 13:07:13 +1000 Subject: [PATCH] Prepare for.0.4.14 release (#447) * prepare for.0.4.14 release * update based on value-bag API * rename to_error to to_borrowed_error * note method name change in changelog * update to released value-bag --- CHANGELOG.md | 10 +++++-- Cargo.toml | 10 +++---- src/kv/value.rs | 69 ++++++++++++++++--------------------------------- src/lib.rs | 2 +- 4 files changed, 36 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ae99ae58..4b57360e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,12 @@ ## [Unreleased] -* Fixed incorrect combination of `kv_unstable` and `std` features causing compile failures +## [0.4.14] - 2021-01-27 + +* Remove the `__private_api_log_lit` special case. +* Fixed incorrect combination of `kv_unstable` and `std` features causing compile failures. +* Remove unstable `Value::to_*` conversions that were incorrectly using `as`. +* Rename unstable `Value::to_error` to `Value::to_borrowed_error`. ## [0.4.13] - 2021-01-11 @@ -191,7 +196,8 @@ version using log 0.4.x to avoid losing module and file information. Look at the [release tags] for information about older releases. -[Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.12...HEAD +[Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.14...HEAD +[0.4.14]: https://github.com/rust-lang-nursery/log/compare/0.4.13...0.4.14 [0.4.13]: https://github.com/rust-lang-nursery/log/compare/0.4.11...0.4.13 [0.4.12]: https://github.com/rust-lang-nursery/log/compare/0.4.11...0.4.12 [0.4.11]: https://github.com/rust-lang-nursery/log/compare/0.4.10...0.4.11 diff --git a/Cargo.toml b/Cargo.toml index 9892a90b3..a86c99ce7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "log" -version = "0.4.13" # remember to update html_root_url +version = "0.4.14" # remember to update html_root_url authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -55,11 +55,11 @@ kv_unstable_serde = ["kv_unstable_std", "value-bag/serde", "serde"] [dependencies] cfg-if = "1.0" serde = { version = "1.0", optional = true, default-features = false } -sval = { version = "1.0.0-alpha.4", optional = true, default-features = false } -value-bag = { version = "1.0.0-alpha.5", optional = true, default-features = false } +sval = { version = "1.0.0-alpha.5", optional = true, default-features = false } +value-bag = { version = "1.0.0-alpha.6", optional = true, default-features = false } [dev-dependencies] serde = { version = "1.0", features = ["derive"] } serde_test = "1.0" -sval = { version = "1.0.0-alpha.4", features = ["derive"] } -value-bag = { version = "1.0.0-alpha.5", features = ["test"] } +sval = { version = "1.0.0-alpha.5", features = ["derive"] } +value-bag = { version = "1.0.0-alpha.6", features = ["test"] } diff --git a/src/kv/value.rs b/src/kv/value.rs index bb79d9103..7dd108090 100644 --- a/src/kv/value.rs +++ b/src/kv/value.rs @@ -58,7 +58,7 @@ impl<'v> ToValue for Value<'v> { /// /// let value = Value::capture_debug(&42i32); /// -/// assert_eq!(Some(42), value.to_i32()); +/// assert_eq!(Some(42), value.to_i64()); /// ``` /// /// ## Using the `Value::from_*` methods @@ -71,7 +71,7 @@ impl<'v> ToValue for Value<'v> { /// /// let value = Value::from_debug(&42i32); /// -/// assert_eq!(None, value.to_i32()); +/// assert_eq!(None, value.to_i64()); /// ``` /// /// ## Using the `ToValue` trait @@ -83,7 +83,7 @@ impl<'v> ToValue for Value<'v> { /// # use log::kv::ToValue; /// let value = 42i32.to_value(); /// -/// assert_eq!(Some(42), value.to_i32()); +/// assert_eq!(Some(42), value.to_i64()); /// ``` /// /// ``` @@ -92,7 +92,7 @@ impl<'v> ToValue for Value<'v> { /// /// let value = (&42i32 as &dyn Debug).to_value(); /// -/// assert_eq!(None, value.to_i32()); +/// assert_eq!(None, value.to_i64()); /// ``` /// /// ## Using the standard `From` trait @@ -104,7 +104,7 @@ impl<'v> ToValue for Value<'v> { /// /// let value = Value::from(42i32); /// -/// assert_eq!(Some(42), value.to_i32()); +/// assert_eq!(Some(42), value.to_i64()); /// ``` pub struct Value<'v> { inner: ValueBag<'v>, @@ -381,31 +381,19 @@ macro_rules! impl_value_to_primitive { } } -impl_to_value_primitive![usize, u8, u16, u32, u64, isize, i8, i16, i32, i64, f32, f64, char, bool,]; +impl_to_value_primitive![ + usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128, f32, f64, char, bool, +]; impl_value_to_primitive![ - #[doc = "Try convert this value into a `usize`."] - to_usize -> usize, - #[doc = "Try convert this value into a `u8`."] - to_u8 -> u8, - #[doc = "Try convert this value into a `u16`."] - to_u16 -> u16, - #[doc = "Try convert this value into a `u32`."] - to_u32 -> u32, #[doc = "Try convert this value into a `u64`."] to_u64 -> u64, - #[doc = "Try convert this value into a `isize`."] - to_isize -> isize, - #[doc = "Try convert this value into a `i8`."] - to_i8 -> i8, - #[doc = "Try convert this value into a `i16`."] - to_i16 -> i16, - #[doc = "Try convert this value into a `i32`."] - to_i32 -> i32, #[doc = "Try convert this value into a `i64`."] to_i64 -> i64, - #[doc = "Try convert this value into a `f32`."] - to_f32 -> f32, + #[doc = "Try convert this value into a `u128`."] + to_u128 -> u128, + #[doc = "Try convert this value into a `i128`."] + to_i128 -> i128, #[doc = "Try convert this value into a `f64`."] to_f64 -> f64, #[doc = "Try convert this value into a `char`."] @@ -417,8 +405,8 @@ impl_value_to_primitive![ impl<'v> Value<'v> { /// Try convert this value into an error. #[cfg(feature = "kv_unstable_std")] - pub fn to_error(&self) -> Option<&(dyn std::error::Error + 'static)> { - self.inner.to_error() + pub fn to_borrowed_error(&self) -> Option<&(dyn std::error::Error + 'static)> { + self.inner.to_borrowed_error() } /// Try convert this value into a borrowed string. @@ -526,8 +514,8 @@ pub(crate) mod tests { fn test_capture_error() { let err = std::io::Error::from(std::io::ErrorKind::Other); - assert!(Value::capture_error(&err).to_error().is_some()); - assert!(Value::from_dyn_error(&err).to_error().is_some()); + assert!(Value::capture_error(&err).to_borrowed_error().is_some()); + assert!(Value::from_dyn_error(&err).to_borrowed_error().is_some()); } #[cfg(feature = "kv_unstable_serde")] @@ -577,35 +565,22 @@ pub(crate) mod tests { #[test] fn test_to_number() { - for v in unsigned().chain(signed()).chain(float()) { - assert!(v.to_u8().is_some()); - assert!(v.to_u16().is_some()); - assert!(v.to_u32().is_some()); + for v in unsigned() { assert!(v.to_u64().is_some()); - assert!(v.to_usize().is_some()); + assert!(v.to_i64().is_some()); + } - assert!(v.to_i8().is_some()); - assert!(v.to_i16().is_some()); - assert!(v.to_i32().is_some()); + for v in signed() { assert!(v.to_i64().is_some()); - assert!(v.to_isize().is_some()); + } - assert!(v.to_f32().is_some()); + for v in unsigned().chain(signed()).chain(float()) { assert!(v.to_f64().is_some()); } for v in bool().chain(str()).chain(char()) { - assert!(v.to_u8().is_none()); - assert!(v.to_u16().is_none()); - assert!(v.to_u32().is_none()); assert!(v.to_u64().is_none()); - - assert!(v.to_i8().is_none()); - assert!(v.to_i16().is_none()); - assert!(v.to_i32().is_none()); assert!(v.to_i64().is_none()); - - assert!(v.to_f32().is_none()); assert!(v.to_f64().is_none()); } } diff --git a/src/lib.rs b/src/lib.rs index a59ce086a..bbfb1ed31 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -266,7 +266,7 @@ #![doc( html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://www.rust-lang.org/favicon.ico", - html_root_url = "https://docs.rs/log/0.4.13" + html_root_url = "https://docs.rs/log/0.4.14" )] #![warn(missing_docs)] #![deny(missing_debug_implementations)]