diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 1bf6f587..69746ee7 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -1,6 +1,6 @@ use clap::{ArgAction, Parser}; -const HELP_TEMPLATE: &'static str = r#" +const HELP_TEMPLATE: &str = r#" {before-help}{name} {version} {author-with-newline}{about-with-newline} {usage-heading} {usage} diff --git a/cli/src/tokenizer.rs b/cli/src/tokenizer.rs index e6d6183f..715bec1b 100644 --- a/cli/src/tokenizer.rs +++ b/cli/src/tokenizer.rs @@ -45,7 +45,7 @@ lazy_static::lazy_static! { }; } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum TokenizerError { QuoteMismatch(String), BacktickMismatch(String), diff --git a/harness/src/build.rs b/harness/src/build.rs index 2664e1ec..48ce8780 100644 --- a/harness/src/build.rs +++ b/harness/src/build.rs @@ -37,7 +37,7 @@ use { pub const BINARIES: [&str; 4] = ["skyd", "sky-bench", "skysh", "sky-migrate"]; /// The build mode -#[derive(Copy, Clone, PartialEq)] +#[derive(Copy, Clone, PartialEq, Eq)] pub enum BuildMode { Debug, Release, diff --git a/server/src/blueql/ast.rs b/server/src/blueql/ast.rs index 27d3a78d..5b8422c7 100644 --- a/server/src/blueql/ast.rs +++ b/server/src/blueql/ast.rs @@ -35,7 +35,7 @@ use { }; #[derive(Debug)] -#[cfg_attr(test, derive(PartialEq))] +#[cfg_attr(test, derive(PartialEq, Eq))] #[repr(u8)] /// A statement that can be executed pub enum Statement { @@ -64,7 +64,7 @@ pub enum Statement { pub type StatementLT<'a> = Life<'a, Statement>; #[derive(Debug)] -#[cfg_attr(test, derive(PartialEq))] +#[cfg_attr(test, derive(PartialEq, Eq))] pub enum Entity { Current(RawSlice), Full(RawSlice, RawSlice), @@ -78,7 +78,7 @@ impl Entity { } #[derive(Debug)] -#[cfg_attr(test, derive(PartialEq))] +#[cfg_attr(test, derive(PartialEq, Eq))] /// The field configuration used when declaring the fields for a model pub struct FieldConfig { /// the types of the fields diff --git a/server/src/blueql/error.rs b/server/src/blueql/error.rs index 6295aa94..ba065143 100644 --- a/server/src/blueql/error.rs +++ b/server/src/blueql/error.rs @@ -29,7 +29,7 @@ use crate::{ protocol::interface::ProtocolSpec, }; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] #[repr(u8)] /// BlueQL errors pub enum LangError { diff --git a/server/src/blueql/lexer.rs b/server/src/blueql/lexer.rs index e2f23249..188aa378 100644 --- a/server/src/blueql/lexer.rs +++ b/server/src/blueql/lexer.rs @@ -33,7 +33,7 @@ use { core::{marker::PhantomData, slice, str}, }; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] #[repr(u8)] /// BQL tokens pub enum Token { @@ -75,7 +75,7 @@ impl From for Token { } } -#[derive(Debug, PartialEq, Clone, Copy)] +#[derive(Debug, PartialEq, Eq, Clone, Copy)] #[repr(u8)] /// BlueQL keywords pub enum Keyword { @@ -90,7 +90,7 @@ pub enum Keyword { Type(Type), } -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u8)] /// BlueQL types pub enum Type { @@ -99,7 +99,7 @@ pub enum Type { List, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] /// Type expression (ty>) pub struct TypeExpression(pub Vec); diff --git a/server/src/blueql/mod.rs b/server/src/blueql/mod.rs index bfbeda12..7dd7fe92 100644 --- a/server/src/blueql/mod.rs +++ b/server/src/blueql/mod.rs @@ -50,7 +50,7 @@ pub fn compile<'a>(src: &'a [u8], extra: usize) -> LangResult() == mem::align_of::<&[u8]>()); diff --git a/server/src/config/cfgfile.rs b/server/src/config/cfgfile.rs index d3283768..cec8c2de 100644 --- a/server/src/config/cfgfile.rs +++ b/server/src/config/cfgfile.rs @@ -34,7 +34,7 @@ use { }; /// This struct is an _object representation_ used for parsing the TOML file -#[derive(Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq, Eq)] pub struct Config { /// The `server` key pub(super) server: ConfigKeyServer, @@ -49,7 +49,7 @@ pub struct Config { } /// This struct represents the `server` key in the TOML file -#[derive(Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq, Eq)] pub struct ConfigKeyServer { /// The host key is any valid IPv4/IPv6 address pub(super) host: IpAddr, @@ -66,7 +66,7 @@ pub struct ConfigKeyServer { } /// The BGSAVE section in the config file -#[derive(Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq, Eq)] pub struct ConfigKeyBGSAVE { /// Whether BGSAVE is enabled or not /// @@ -80,7 +80,7 @@ pub struct ConfigKeyBGSAVE { } /// The snapshot section in the TOML file -#[derive(Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq, Eq)] pub struct ConfigKeySnapshot { /// After how many seconds should the snapshot be created pub(super) every: u64, @@ -92,7 +92,7 @@ pub struct ConfigKeySnapshot { pub(super) failsafe: Option, } -#[derive(Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq, Eq)] pub struct KeySslOpts { pub(super) key: String, pub(super) chain: String, diff --git a/server/src/config/definitions.rs b/server/src/config/definitions.rs index fab2c0c7..b356d990 100644 --- a/server/src/config/definitions.rs +++ b/server/src/config/definitions.rs @@ -39,7 +39,7 @@ use { /// /// If BGSAVE is enabled, then the duration (corresponding to `every`) is wrapped in the `Enabled` /// variant. Otherwise, the `Disabled` variant is to be used -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Eq, Debug)] pub enum BGSave { Enabled(u64), Disabled, @@ -69,7 +69,7 @@ impl BGSave { } #[repr(u8)] -#[derive(Debug, PartialEq)] +#[derive(Debug, Eq, PartialEq)] pub enum ProtocolVersion { V1, V2, @@ -119,7 +119,7 @@ impl<'de> Deserialize<'de> for ProtocolVersion { /// A `ConfigurationSet` which can be used by main::check_args_or_connect() to bind /// to a `TcpListener` and show the corresponding terminal output for the given /// configuration -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct ConfigurationSet { /// If `noart` is set to true, no terminal artwork should be displayed pub noart: bool, @@ -196,7 +196,7 @@ impl ConfigurationSet { /// and will not even activate the non-SSL socket /// - `InsecureOnly` : This indicates that the server would only accept non-SSL connections /// and will not even activate the SSL socket -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum PortConfig { SecureOnly { host: IpAddr, @@ -273,7 +273,7 @@ impl PortConfig { } } -#[derive(Deserialize, Debug, PartialEq)] +#[derive(Deserialize, Debug, PartialEq, Eq)] pub struct SslOpts { pub key: String, pub chain: String, @@ -295,7 +295,7 @@ impl SslOpts { } } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] /// The snapshot configuration /// pub struct SnapshotPref { @@ -322,7 +322,7 @@ impl SnapshotPref { } } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] /// Snapshotting configuration /// /// The variant `Enabled` directly carries a `ConfigKeySnapshot` object that @@ -346,7 +346,7 @@ impl SnapshotConfig { type RestoreFile = Option; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] /// The type of configuration: /// - The default configuration /// - A custom supplied configuration @@ -413,7 +413,7 @@ impl ConfigType { } } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum Modeset { Dev, Prod, @@ -458,7 +458,7 @@ impl<'de> Deserialize<'de> for Modeset { } } -#[derive(Debug, PartialEq, Deserialize)] +#[derive(Debug, PartialEq, Eq, Deserialize)] pub struct AuthSettings { pub origin_key: Option, } diff --git a/server/src/config/feedback.rs b/server/src/config/feedback.rs index eb797ec3..5c51863e 100644 --- a/server/src/config/feedback.rs +++ b/server/src/config/feedback.rs @@ -38,7 +38,7 @@ const EMSG_ENV: &str = "Environment"; const EMSG_PROD: &str = "Production mode"; const TAB: &str = " "; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct FeedbackStack { stack: Vec, feedback_type: &'static str, @@ -93,7 +93,7 @@ impl ops::DerefMut for FeedbackStack { } } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct ErrorStack { feedback: FeedbackStack, } @@ -125,7 +125,7 @@ impl ops::DerefMut for ErrorStack { } } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct WarningStack { feedback: FeedbackStack, } diff --git a/server/src/config/mod.rs b/server/src/config/mod.rs index 1d3d7b61..52fa9406 100644 --- a/server/src/config/mod.rs +++ b/server/src/config/mod.rs @@ -62,7 +62,7 @@ const DEFAULT_SSL_PORT: u16 = 2004; type StaticStr = &'static str; -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct AuthkeyWrapper(pub Authkey); impl AuthkeyWrapper { @@ -186,7 +186,7 @@ impl<'a, T: FromStr + 'a> TryFromConfigSource for Result { } } -#[derive(Debug, PartialEq, Default)] +#[derive(Debug, PartialEq, Eq, Default)] /// Since we have conflicting trait implementations, we define a custom `Option` type pub struct OptString { base: Option, diff --git a/server/src/corestore/memstore.rs b/server/src/corestore/memstore.rs index 21050a84..9e4d22b6 100644 --- a/server/src/corestore/memstore.rs +++ b/server/src/corestore/memstore.rs @@ -134,7 +134,7 @@ mod cluster { } } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] /// Errors arising from trying to modify/access containers #[allow(dead_code)] pub enum DdlError { diff --git a/server/src/protocol/mod.rs b/server/src/protocol/mod.rs index 09b6c52b..65a39219 100644 --- a/server/src/protocol/mod.rs +++ b/server/src/protocol/mod.rs @@ -49,7 +49,7 @@ pub const LATEST_PROTOCOL_VERSION: f32 = Skyhash2::PROTOCOL_VERSION; /// The latest protocol version supported by this version (`Skyhash-x.y`) pub const LATEST_PROTOCOL_VERSIONSTRING: &str = Skyhash2::PROTOCOL_VERSIONSTRING; -#[derive(PartialEq)] +#[derive(PartialEq, Eq)] /// As its name says, an [`UnsafeSlice`] is a terribly unsafe slice. It's guarantess are /// very C-like, your ptr goes dangling -- and everything is unsafe. /// @@ -94,7 +94,7 @@ impl UnsafeSlice { } } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] #[repr(u8)] /// # Parser Errors /// diff --git a/server/src/storage/v1/sengine.rs b/server/src/storage/v1/sengine.rs index f8610eae..5f6f9860 100644 --- a/server/src/storage/v1/sengine.rs +++ b/server/src/storage/v1/sengine.rs @@ -92,7 +92,7 @@ pub struct SnapshotEngine { remote_queue: QuickLock>>, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum SnapshotActionResult { Ok, Busy, @@ -267,7 +267,7 @@ mod queue { //! This implementation is specifically built for use with the snapshotting utility use super::QStore; use crate::corestore::iarray; - #[derive(Debug, PartialEq)] + #[derive(Debug, PartialEq, Eq)] pub struct Queue { queue: QStore, maxlen: usize, diff --git a/server/src/util/mod.rs b/server/src/util/mod.rs index ee7b139f..2acdeab5 100644 --- a/server/src/util/mod.rs +++ b/server/src/util/mod.rs @@ -136,7 +136,7 @@ impl Clone for Wrapper { } } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] /// This is yet another compiler hack and has no "actual impact" in terms of memory alignment. /// /// When it's hard to have a _split mutable borrow_, all across the source we use custom diff --git a/server/src/util/os.rs b/server/src/util/os.rs index 028c5191..90e4c9f5 100644 --- a/server/src/util/os.rs +++ b/server/src/util/os.rs @@ -218,7 +218,7 @@ fn rcopy_okay() { fs::remove_dir_all("my-backups").unwrap(); } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum EntryKind { Directory(String), File(String), diff --git a/sky-bench/src/cli.rs b/sky-bench/src/cli.rs index 4951416e..1df6c485 100644 --- a/sky-bench/src/cli.rs +++ b/sky-bench/src/cli.rs @@ -1,6 +1,6 @@ use clap::{ArgAction, Parser}; -const HELP_TEMPLATE: &'static str = r#" +const HELP_TEMPLATE: &str = r#" {before-help}{name} {version} {author-with-newline}{about-with-newline} {usage-heading} {usage} @@ -94,7 +94,7 @@ mod tests { assert_eq!(cli.runs, 5); assert_eq!(cli.kvsize, 3); assert_eq!(cli.query_count, 100_000); - assert_eq!(cli.json, false); + assert!(!cli.json); } #[test] @@ -119,6 +119,6 @@ mod tests { assert_eq!(cli.host, "devil"); assert_eq!(cli.port, 666); - assert_eq!(cli.json, true); + assert!(cli.json); } } diff --git a/sky-bench/src/main.rs b/sky-bench/src/main.rs index 38632ca3..b938d992 100644 --- a/sky-bench/src/main.rs +++ b/sky-bench/src/main.rs @@ -59,5 +59,5 @@ fn run() -> error::BResult<()> { // Run our task bench::run_bench(server_config, bench_config)?; - util::cleanup(&server_config) + util::cleanup(server_config) } diff --git a/sky-migrate/src/cli.rs b/sky-migrate/src/cli.rs index 029f20a3..2b92081a 100644 --- a/sky-migrate/src/cli.rs +++ b/sky-migrate/src/cli.rs @@ -1,6 +1,6 @@ use clap::Parser; -const HELP_TEMPLATE: &'static str = r#" +const HELP_TEMPLATE: &str = r#" {before-help}{name} {version} {author-with-newline}{about-with-newline} {usage-heading} {usage} @@ -47,7 +47,7 @@ mod tests { let cli = Cli::parse_from(args.into_iter()); assert_eq!(cli.new, "localhost:1234"); assert_eq!(cli.prevdir, "/tmp/skyd1"); - assert_eq!(cli.serial, false); + assert!(!cli.serial); } #[test] @@ -63,7 +63,7 @@ mod tests { let cli = Cli::parse_from(args.into_iter()); assert_eq!(cli.new, "localhost:1234"); assert_eq!(cli.prevdir, "/tmp/skyd1"); - assert_eq!(cli.serial, true); + assert!(cli.serial); } #[test]