From 42725789a056d706157f79c28a707d53ad08ff54 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sat, 18 Mar 2023 09:18:22 +0000 Subject: [PATCH] Upgrade Rust code deprecation warnings --- lib/src/dbs/auth.rs | 9 ++------- lib/src/sql/geometry.rs | 2 +- lib/src/sql/operation.rs | 9 ++------- lib/src/sql/value/value.rs | 9 ++------- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/lib/src/dbs/auth.rs b/lib/src/dbs/auth.rs index 2c383d8e..b43f2910 100644 --- a/lib/src/dbs/auth.rs +++ b/lib/src/dbs/auth.rs @@ -9,9 +9,10 @@ pub enum Level { } /// Specifies the current authentication for the datastore execution context. -#[derive(Clone, Debug, Eq, PartialEq, PartialOrd)] +#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd)] pub enum Auth { /// Specifies that the user is not authenticated + #[default] No, /// Specifies that the user is authenticated with full root permissions Kv, @@ -23,12 +24,6 @@ pub enum Auth { Sc(String, String, String), } -impl Default for Auth { - fn default() -> Self { - Auth::No - } -} - impl Auth { /// Checks whether the current authentication has root level permissions pub fn is_kv(&self) -> bool { diff --git a/lib/src/sql/geometry.rs b/lib/src/sql/geometry.rs index 270b5abc..8f5fb50e 100644 --- a/lib/src/sql/geometry.rs +++ b/lib/src/sql/geometry.rs @@ -1,4 +1,4 @@ -#![allow(clippy::derive_hash_xor_eq)] +#![allow(clippy::derived_hash_with_manual_eq)] use crate::sql::comment::mightbespace; use crate::sql::common::commas; diff --git a/lib/src/sql/operation.rs b/lib/src/sql/operation.rs index 54455997..ebe6f8e4 100644 --- a/lib/src/sql/operation.rs +++ b/lib/src/sql/operation.rs @@ -9,21 +9,16 @@ pub struct Operation { pub value: Value, } -#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)] +#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)] pub enum Op { None, + #[default] Add, Remove, Replace, Change, } -impl Default for Op { - fn default() -> Op { - Op::Add - } -} - impl From<&Value> for Op { fn from(v: &Value) -> Self { match v.to_strand().as_str() { diff --git a/lib/src/sql/value/value.rs b/lib/src/sql/value/value.rs index 7b5d8cb2..44249cea 100644 --- a/lib/src/sql/value/value.rs +++ b/lib/src/sql/value/value.rs @@ -96,8 +96,9 @@ pub fn whats(i: &str) -> IResult<&str, Values> { Ok((i, Values(v))) } -#[derive(Clone, Debug, PartialEq, PartialOrd, Deserialize, Store, Hash)] +#[derive(Clone, Debug, Default, PartialEq, PartialOrd, Deserialize, Store, Hash)] pub enum Value { + #[default] None, Null, False, @@ -135,12 +136,6 @@ impl Ord for Value { } } -impl Default for Value { - fn default() -> Value { - Value::None - } -} - impl From for Value { #[inline] fn from(v: bool) -> Self {