فهرست منبع

cargo clippy fixes for Data

I must have implemented half of clippy's suggestions from last time. Derp!

Theres the rest of clippy's suggested use matches! macro.
david 10 ماه پیش
والد
کامیت
cd03e7de88
1فایلهای تغییر یافته به همراه3 افزوده شده و 14 حذف شده
  1. 3 14
      src/data.rs

+ 3 - 14
src/data.rs

@@ -499,30 +499,19 @@ impl Data {
     /// 
     /// JSON Number's can hold both a whole number (i.e. signed/unsigned integers) and floats
     pub fn is_number(&self) -> bool {
-        match self {
-            Self::I8(_) | Self::I16(_) | Self::I32(_) | Self::I64(_) | Self::I128(_) => true,
-            Self::U8(_) | Self::U16(_) | Self::U32(_) | Self::U64(_) | Self::U128(_) => true,
-            Self::F32(_) | Self::F64(_) => true,
-            _ => false
-        }
+        matches!(self, Self::I8(_) | Self::I16(_) | Self::I32(_) | Self::I64(_) | Self::I128(_) | Self::U8(_) | Self::U16(_) | Self::U32(_) | Self::U64(_) | Self::U128(_) | Self::F32(_) | Self::F64(_))
     }
     /// Is Data a signed integer (Regardless of bits)
     /// 
     /// i.e. i8, i16, i32, i64, i128 or neither
     pub fn is_int(&self) -> bool {
-        match self {
-            Self::I8(_) | Self::I16(_) | Self::I32(_) | Self::I64(_) | Self::I128(_) => true,
-            _ => false
-        }
+        matches!(self, Self::I8(_) | Self::I16(_) | Self::I32(_) | Self::I64(_) | Self::I128(_))
     }
     /// Is Data a unsigned integer (Regardless of bits)
     /// 
     /// i.e. u8, u16, u32, u64, or u128 or neither
     pub fn is_uint(&self) -> bool {
-        match self {
-            Self::U8(_) | Self::U16(_) | Self::U32(_) | Self::U64(_) | Self::U128(_) => true,
-            _ => false
-        }
+        matches!(self, Self::U8(_) | Self::U16(_) | Self::U32(_) | Self::U64(_) | Self::U128(_))
     }
     /// Is Data a f32 or f64 or neither
     pub fn is_float(&self) -> bool {