From febfc4c6afee97ceaff791cf61e3e69339d59e3e Mon Sep 17 00:00:00 2001 From: Thomas de Zeeuw Date: Thu, 19 Oct 2023 19:35:33 +0200 Subject: [PATCH 1/2] Rename Value::to_str to to_cow_str --- src/kv/value.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kv/value.rs b/src/kv/value.rs index 312232003..ebb0db41b 100644 --- a/src/kv/value.rs +++ b/src/kv/value.rs @@ -607,7 +607,7 @@ mod std_support { impl<'v> Value<'v> { /// Try convert this value into a string. - pub fn to_str(&self) -> Option> { + pub fn to_cow_str(&self) -> Option> { self.inner.to_str() } } From 8ca0b692fba2ed25ce0f3ed6f2c4772667e7515e Mon Sep 17 00:00:00 2001 From: Thomas de Zeeuw Date: Thu, 19 Oct 2023 19:44:18 +0200 Subject: [PATCH 2/2] Fix tests --- src/kv/value.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/kv/value.rs b/src/kv/value.rs index ebb0db41b..e8646b422 100644 --- a/src/kv/value.rs +++ b/src/kv/value.rs @@ -894,12 +894,12 @@ pub(crate) mod tests { } #[test] - fn test_to_str() { + fn test_to_cow_str() { for v in str() { assert!(v.to_borrowed_str().is_some()); #[cfg(feature = "kv_unstable_std")] - assert!(v.to_str().is_some()); + assert!(v.to_cow_str().is_some()); } let short_lived = String::from("short lived"); @@ -908,13 +908,13 @@ pub(crate) mod tests { assert!(v.to_borrowed_str().is_some()); #[cfg(feature = "kv_unstable_std")] - assert!(v.to_str().is_some()); + assert!(v.to_cow_str().is_some()); for v in unsigned().chain(signed()).chain(float()).chain(bool()) { assert!(v.to_borrowed_str().is_none()); #[cfg(feature = "kv_unstable_std")] - assert!(v.to_str().is_none()); + assert!(v.to_cow_str().is_none()); } }