Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for.0.4.14 release #447

Merged
merged 7 commits into from Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions 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"
Expand Down Expand Up @@ -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"] }
69 changes: 22 additions & 47 deletions src/kv/value.rs
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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());
/// ```
///
/// ```
Expand All @@ -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
Expand All @@ -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>,
Expand Down Expand Up @@ -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`."]
Expand All @@ -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.
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Expand Up @@ -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)]
Expand Down