Upgrade Rust code deprecation warnings

This commit is contained in:
Tobie Morgan Hitchcock 2023-03-18 09:18:22 +00:00
parent f48de42695
commit 42725789a0
4 changed files with 7 additions and 22 deletions

View file

@ -9,9 +9,10 @@ pub enum Level {
} }
/// Specifies the current authentication for the datastore execution context. /// 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 { pub enum Auth {
/// Specifies that the user is not authenticated /// Specifies that the user is not authenticated
#[default]
No, No,
/// Specifies that the user is authenticated with full root permissions /// Specifies that the user is authenticated with full root permissions
Kv, Kv,
@ -23,12 +24,6 @@ pub enum Auth {
Sc(String, String, String), Sc(String, String, String),
} }
impl Default for Auth {
fn default() -> Self {
Auth::No
}
}
impl Auth { impl Auth {
/// Checks whether the current authentication has root level permissions /// Checks whether the current authentication has root level permissions
pub fn is_kv(&self) -> bool { pub fn is_kv(&self) -> bool {

View file

@ -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::comment::mightbespace;
use crate::sql::common::commas; use crate::sql::common::commas;

View file

@ -9,21 +9,16 @@ pub struct Operation {
pub value: Value, 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 { pub enum Op {
None, None,
#[default]
Add, Add,
Remove, Remove,
Replace, Replace,
Change, Change,
} }
impl Default for Op {
fn default() -> Op {
Op::Add
}
}
impl From<&Value> for Op { impl From<&Value> for Op {
fn from(v: &Value) -> Self { fn from(v: &Value) -> Self {
match v.to_strand().as_str() { match v.to_strand().as_str() {

View file

@ -96,8 +96,9 @@ pub fn whats(i: &str) -> IResult<&str, Values> {
Ok((i, Values(v))) Ok((i, Values(v)))
} }
#[derive(Clone, Debug, PartialEq, PartialOrd, Deserialize, Store, Hash)] #[derive(Clone, Debug, Default, PartialEq, PartialOrd, Deserialize, Store, Hash)]
pub enum Value { pub enum Value {
#[default]
None, None,
Null, Null,
False, False,
@ -135,12 +136,6 @@ impl Ord for Value {
} }
} }
impl Default for Value {
fn default() -> Value {
Value::None
}
}
impl From<bool> for Value { impl From<bool> for Value {
#[inline] #[inline]
fn from(v: bool) -> Self { fn from(v: bool) -> Self {