From 2be6b7943affa588b77557e298c7425b29e4b644 Mon Sep 17 00:00:00 2001 From: "Heinz N. Gies" Date: Tue, 7 Oct 2025 10:39:20 +0200 Subject: [PATCH 1/2] Obey clippy Signed-off-by: Heinz N. Gies --- src/generator.rs | 2 +- src/impls.rs | 43 ------------------------------------------- src/node.rs | 16 ---------------- src/node/cmp.rs | 18 ------------------ src/node/from.rs | 13 ------------- 5 files changed, 1 insertion(+), 91 deletions(-) diff --git a/src/generator.rs b/src/generator.rs index ab84d81..b04ddef 100644 --- a/src/generator.rs +++ b/src/generator.rs @@ -440,7 +440,7 @@ where stry!(u_encode(writer, *ch)); } else { stry!(writer.write_all(&[b'\\', escape])); - }; + } start = index + 1; } } diff --git a/src/impls.rs b/src/impls.rs index e8e453d..e9dd46e 100644 --- a/src/impls.rs +++ b/src/impls.rs @@ -282,7 +282,6 @@ where type Key = ::Key; type Target = ::Element; #[inline] - #[must_use] fn get(&self, k: &Q) -> Option<&Self::Target> where Self::Key: Borrow, @@ -292,7 +291,6 @@ where } #[inline] - #[must_use] fn contains_key(&self, k: &Q) -> bool where Self::Key: Borrow, @@ -326,7 +324,6 @@ where { type Target = <::Array as Indexed>::Element; #[inline] - #[must_use] fn get_idx(&self, i: I) -> Option<&Self::Target> { self.as_array().and_then(|a| a.get(i)) } @@ -356,7 +353,6 @@ where { type Key = T::Key; #[inline] - #[must_use] fn get_bool(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -366,7 +362,6 @@ where } #[inline] - #[must_use] fn get_i128(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -376,7 +371,6 @@ where } #[inline] - #[must_use] fn get_i64(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -386,7 +380,6 @@ where } #[inline] - #[must_use] fn get_i32(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -396,7 +389,6 @@ where } #[inline] - #[must_use] fn get_i16(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -406,7 +398,6 @@ where } #[inline] - #[must_use] fn get_i8(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -416,7 +407,6 @@ where } #[inline] - #[must_use] fn get_u128(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -426,7 +416,6 @@ where } #[inline] - #[must_use] fn get_u64(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -436,7 +425,6 @@ where } #[inline] - #[must_use] fn get_usize(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -446,7 +434,6 @@ where } #[inline] - #[must_use] fn get_u32(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -456,7 +443,6 @@ where } #[inline] - #[must_use] fn get_u16(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -466,7 +452,6 @@ where } #[inline] - #[must_use] fn get_u8(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -476,7 +461,6 @@ where } #[inline] - #[must_use] fn get_f64(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -486,7 +470,6 @@ where } #[inline] - #[must_use] fn get_f32(&self, k: &Q) -> Option where Self::Key: Borrow, @@ -496,7 +479,6 @@ where } #[inline] - #[must_use] fn get_str(&self, k: &Q) -> Option<&str> where Self::Key: Borrow, @@ -516,7 +498,6 @@ where type Array = ::Array; #[inline] - #[must_use] fn get_array(&self, k: &Q) -> Option<&Self::Array> where Self::Key: Borrow, @@ -535,7 +516,6 @@ where type Object = ::Object; #[inline] - #[must_use] fn get_object(&self, k: &Q) -> Option<&Self::Object> where Self::Key: Borrow, @@ -747,127 +727,106 @@ where T: ValueAsScalar, { #[inline] - #[must_use] fn is_null(&self) -> bool { self.as_null().is_some() } #[inline] - #[must_use] fn is_float(&self) -> bool { self.is_f64() } #[inline] - #[must_use] fn is_integer(&self) -> bool { self.is_i128() || self.is_u128() } #[inline] - #[must_use] fn is_number(&self) -> bool { self.is_float() || self.is_integer() } #[inline] - #[must_use] fn is_bool(&self) -> bool { self.as_bool().is_some() } #[inline] - #[must_use] fn is_i128(&self) -> bool { self.as_i128().is_some() } #[inline] - #[must_use] fn is_i64(&self) -> bool { self.as_i64().is_some() } #[inline] - #[must_use] fn is_i32(&self) -> bool { self.as_i32().is_some() } #[inline] - #[must_use] fn is_i16(&self) -> bool { self.as_i16().is_some() } #[inline] - #[must_use] fn is_i8(&self) -> bool { self.as_i8().is_some() } #[inline] - #[must_use] fn is_u128(&self) -> bool { self.as_u128().is_some() } #[inline] - #[must_use] fn is_u64(&self) -> bool { self.as_u64().is_some() } #[inline] - #[must_use] fn is_usize(&self) -> bool { self.as_usize().is_some() } #[inline] - #[must_use] fn is_u32(&self) -> bool { self.as_u32().is_some() } #[inline] - #[must_use] fn is_u16(&self) -> bool { self.as_u16().is_some() } #[inline] - #[must_use] fn is_u8(&self) -> bool { self.as_u8().is_some() } #[inline] - #[must_use] fn is_f64(&self) -> bool { self.as_f64().is_some() } #[inline] - #[must_use] fn is_f64_castable(&self) -> bool { self.cast_f64().is_some() } #[inline] - #[must_use] fn is_f32(&self) -> bool { self.as_f32().is_some() } #[inline] - #[must_use] fn is_str(&self) -> bool { self.as_str().is_some() } #[inline] - #[must_use] fn is_char(&self) -> bool { self.as_char().is_some() } @@ -878,7 +837,6 @@ where T: ValueAsArray, { #[inline] - #[must_use] fn is_array(&self) -> bool { self.as_array().is_some() } @@ -888,7 +846,6 @@ where T: ValueAsObject, { #[inline] - #[must_use] fn is_object(&self) -> bool { self.as_object().is_some() } diff --git a/src/node.rs b/src/node.rs index a7c5e09..45baa20 100644 --- a/src/node.rs +++ b/src/node.rs @@ -18,7 +18,6 @@ mod from; #[cfg_attr(feature = "ordered-float", derive(Eq))] #[cfg_attr(feature = "c-abi", repr(C))] #[cfg_attr(feature = "c-abi", derive(abi_stable::StableAbi))] - pub enum StaticNode { /// A signed 64 bit integer. I64(i64), @@ -45,7 +44,6 @@ pub enum StaticNode { impl Index<&str> for StaticNode { type Output = (); #[inline] - #[must_use] fn index(&self, _index: &str) -> &Self::Output { panic!("Not supported") } @@ -54,7 +52,6 @@ impl Index<&str> for StaticNode { impl Index for StaticNode { type Output = (); #[inline] - #[must_use] fn index(&self, _index: usize) -> &Self::Output { panic!("Not supported") } @@ -62,7 +59,6 @@ impl Index for StaticNode { impl IndexMut<&str> for StaticNode { #[inline] - #[must_use] fn index_mut(&mut self, _index: &str) -> &mut Self::Output { panic!("Not supported") } @@ -70,7 +66,6 @@ impl IndexMut<&str> for StaticNode { impl IndexMut for StaticNode { #[inline] - #[must_use] fn index_mut(&mut self, _index: usize) -> &mut Self::Output { panic!("Not supported") } @@ -79,7 +74,6 @@ impl IndexMut for StaticNode { impl TypedValue for StaticNode { #[cfg(not(feature = "128bit"))] #[inline] - #[must_use] fn value_type(&self) -> ValueType { match self { Self::Null => ValueType::Null, @@ -93,7 +87,6 @@ impl TypedValue for StaticNode { #[cfg(feature = "128bit")] #[inline] - #[must_use] fn value_type(&self) -> ValueType { match self { Self::Null => ValueType::Null, @@ -109,7 +102,6 @@ impl TypedValue for StaticNode { impl ValueAsScalar for StaticNode { #[inline] - #[must_use] fn as_null(&self) -> Option<()> { match self { Self::Null => Some(()), @@ -117,7 +109,6 @@ impl ValueAsScalar for StaticNode { } } #[inline] - #[must_use] fn as_bool(&self) -> Option { match self { Self::Bool(b) => Some(*b), @@ -127,7 +118,6 @@ impl ValueAsScalar for StaticNode { #[cfg(not(feature = "128bit"))] #[inline] - #[must_use] fn as_i64(&self) -> Option { match self { Self::I64(i) => Some(*i), @@ -164,7 +154,6 @@ impl ValueAsScalar for StaticNode { #[cfg(not(feature = "128bit"))] #[inline] - #[must_use] fn as_u64(&self) -> Option { match self { Self::I64(i) => u64::try_from(*i).ok(), @@ -199,7 +188,6 @@ impl ValueAsScalar for StaticNode { } #[inline] - #[must_use] fn as_f64(&self) -> Option { match self { #[allow(clippy::useless_conversion)] // .into() required by ordered-float @@ -210,7 +198,6 @@ impl ValueAsScalar for StaticNode { #[cfg(not(feature = "128bit"))] #[inline] - #[must_use] #[allow(clippy::cast_precision_loss)] fn cast_f64(&self) -> Option { match self { @@ -238,7 +225,6 @@ impl ValueAsScalar for StaticNode { } #[inline] - #[must_use] fn as_str(&self) -> Option<&str> { None } @@ -279,7 +265,6 @@ impl fmt::Display for StaticNode { impl PartialEq for StaticNode { #[cfg(not(feature = "128bit"))] #[inline] - #[must_use] fn eq(&self, other: &Self) -> bool { match (self, other) { (Self::Null, Self::Null) => true, @@ -333,7 +318,6 @@ impl PartialEq for StaticNode { } impl Default for StaticNode { - #[must_use] fn default() -> Self { Self::Null } diff --git a/src/node/cmp.rs b/src/node/cmp.rs index 63ac292..469716c 100644 --- a/src/node/cmp.rs +++ b/src/node/cmp.rs @@ -4,7 +4,6 @@ use super::StaticNode; impl PartialEq<()> for StaticNode { #[inline] - #[must_use] fn eq(&self, _other: &()) -> bool { self.is_null() } @@ -12,7 +11,6 @@ impl PartialEq<()> for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &bool) -> bool { self.as_bool().is_some_and(|t| t.eq(other)) } @@ -20,7 +18,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &str) -> bool { self.as_str().is_some_and(|t| t.eq(other)) } @@ -28,7 +25,6 @@ impl PartialEq for StaticNode { impl PartialEq<&str> for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &&str) -> bool { self == *other } @@ -36,7 +32,6 @@ impl PartialEq<&str> for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &String) -> bool { self.as_str().is_some_and(|t| t.eq(other)) } @@ -44,7 +39,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &i8) -> bool { self.as_i8().is_some_and(|t| t.eq(other)) } @@ -52,7 +46,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &i16) -> bool { self.as_i16().is_some_and(|t| t.eq(other)) } @@ -60,7 +53,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &i32) -> bool { self.as_i32().is_some_and(|t| t.eq(other)) } @@ -68,7 +60,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &i64) -> bool { self.as_i64().is_some_and(|t| t.eq(other)) } @@ -76,7 +67,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &i128) -> bool { self.as_i128().is_some_and(|t| t.eq(other)) } @@ -84,7 +74,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &u8) -> bool { self.as_u8().is_some_and(|t| t.eq(other)) } @@ -92,7 +81,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &u16) -> bool { self.as_u16().is_some_and(|t| t.eq(other)) } @@ -100,7 +88,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &u32) -> bool { self.as_u32().is_some_and(|t| t.eq(other)) } @@ -108,7 +95,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &u64) -> bool { self.as_u64().is_some_and(|t| t.eq(other)) } @@ -116,7 +102,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &usize) -> bool { self.as_usize().is_some_and(|t| t.eq(other)) } @@ -124,7 +109,6 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &u128) -> bool { self.as_u128().is_some_and(|t| t.eq(other)) } @@ -132,14 +116,12 @@ impl PartialEq for StaticNode { impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &f32) -> bool { self.as_f32().is_some_and(|t| t.eq(other)) } } impl PartialEq for StaticNode { #[inline] - #[must_use] fn eq(&self, other: &f64) -> bool { self.as_f64().is_some_and(|t| t.eq(other)) } diff --git a/src/node/from.rs b/src/node/from.rs index cbf3fc3..542ee46 100644 --- a/src/node/from.rs +++ b/src/node/from.rs @@ -7,7 +7,6 @@ use crate::StaticNode; impl From for StaticNode { #[inline] - #[must_use] fn from(b: bool) -> Self { Self::Bool(b) } @@ -15,7 +14,6 @@ impl From for StaticNode { impl From<()> for StaticNode { #[inline] - #[must_use] fn from(_b: ()) -> Self { Self::Null } @@ -24,7 +22,6 @@ impl From<()> for StaticNode { /********* i_ **********/ impl From for StaticNode { #[inline] - #[must_use] fn from(i: i8) -> Self { Self::I64(i64::from(i)) } @@ -32,7 +29,6 @@ impl From for StaticNode { impl From for StaticNode { #[inline] - #[must_use] fn from(i: i16) -> Self { Self::I64(i64::from(i)) } @@ -40,7 +36,6 @@ impl From for StaticNode { impl From for StaticNode { #[inline] - #[must_use] fn from(i: i32) -> Self { Self::I64(i64::from(i)) } @@ -48,7 +43,6 @@ impl From for StaticNode { impl From for StaticNode { #[inline] - #[must_use] fn from(i: i64) -> Self { Self::I64(i) } @@ -65,7 +59,6 @@ impl From for StaticNode { /********* u_ **********/ impl From for StaticNode { #[inline] - #[must_use] fn from(i: u8) -> Self { Self::U64(u64::from(i)) } @@ -73,7 +66,6 @@ impl From for StaticNode { impl From for StaticNode { #[inline] - #[must_use] fn from(i: u16) -> Self { Self::U64(u64::from(i)) } @@ -81,7 +73,6 @@ impl From for StaticNode { impl From for StaticNode { #[inline] - #[must_use] fn from(i: u32) -> Self { Self::U64(u64::from(i)) } @@ -89,7 +80,6 @@ impl From for StaticNode { impl From for StaticNode { #[inline] - #[must_use] fn from(i: u64) -> Self { Self::U64(i) } @@ -106,7 +96,6 @@ impl From for StaticNode { impl From for StaticNode { #[inline] - #[must_use] fn from(i: usize) -> Self { Self::U64(i as u64) } @@ -116,7 +105,6 @@ impl From for StaticNode { #[cfg(not(feature = "ordered-float"))] impl From for StaticNode { #[inline] - #[must_use] fn from(f: f32) -> Self { Self::F64(f64::from(f)) } @@ -125,7 +113,6 @@ impl From for StaticNode { #[cfg(not(feature = "ordered-float"))] impl From for StaticNode { #[inline] - #[must_use] fn from(f: f64) -> Self { Self::F64(f) } From 228b11008476660175f78b867c2173734e3ee7be Mon Sep 17 00:00:00 2001 From: "Heinz N. Gies" Date: Tue, 7 Oct 2025 10:39:27 +0200 Subject: [PATCH 2/2] bump Signed-off-by: Heinz N. Gies --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 83a664c..5a97519 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "value-trait" -version = "0.11.0" +version = "0.12.0" authors = ["Heinz N. Gies "] edition = "2024" license = "Apache-2.0/MIT" @@ -14,10 +14,10 @@ rust-version = "1.85" [dependencies] itoa = "1" ryu = "1" -halfbrown = { version = "0.3", optional = true } +halfbrown = { version = "0.4", optional = true } float-cmp = "0.10" ordered-float = { version = "5", optional = true } -hashbrown = { version = "0.15", optional = true } +hashbrown = { version = "0.16", optional = true } abi_stable = { version = "0.11.0", optional = true, default-features = false } [features]