From 6f7442e5a33f1e4b6bdcdb6241ab0ad4c604a674 Mon Sep 17 00:00:00 2001 From: Constantin Nickel Date: Tue, 21 Jun 2022 19:37:11 +0200 Subject: [PATCH] Group & sort derive macros alphabetically The derive macros are grouped into `std` & third party and sorted alphabetically. ``` struct Foo; ``` --- command_attr/src/attributes.rs | 2 +- command_attr/src/util.rs | 2 +- src/builder/create_allowed_mentions.rs | 2 +- src/client/bridge/gateway/mod.rs | 2 +- src/framework/standard/args.rs | 6 ++-- src/framework/standard/structures/mod.rs | 4 +-- src/gateway/mod.rs | 2 +- src/model/application.rs | 2 +- src/model/application/command.rs | 6 ++-- src/model/application/component.rs | 6 ++-- src/model/application/interaction/mod.rs | 6 ++-- src/model/application/interaction/ping.rs | 2 +- src/model/application/oauth.rs | 2 +- src/model/channel/mod.rs | 4 +-- src/model/channel/partial_channel.rs | 4 +-- src/model/connection.rs | 2 +- src/model/event.rs | 2 +- src/model/gateway.rs | 2 +- src/model/guild/audit_log.rs | 28 +++++++++---------- src/model/guild/guild_id.rs | 2 +- src/model/guild/integration.rs | 2 +- src/model/guild/premium_tier.rs | 2 +- src/model/guild/scheduled_event.rs | 4 +-- src/model/mention.rs | 2 +- src/model/misc.rs | 2 +- src/model/user.rs | 4 +-- src/utils/argument_convert/_template.rs | 2 +- src/utils/argument_convert/emoji.rs | 2 +- src/utils/argument_convert/guild.rs | 2 +- src/utils/argument_convert/member.rs | 2 +- src/utils/argument_convert/user.rs | 2 +- voice-model/src/close_code.rs | 2 +- voice-model/src/opcode.rs | 2 +- voice-model/src/payload/client_connect.rs | 2 +- voice-model/src/payload/client_disconnect.rs | 2 +- voice-model/src/payload/heartbeat.rs | 2 +- voice-model/src/payload/heartbeat_ack.rs | 2 +- voice-model/src/payload/identify.rs | 2 +- voice-model/src/payload/ready.rs | 2 +- voice-model/src/payload/resume.rs | 2 +- voice-model/src/payload/select_protocol.rs | 2 +- .../src/payload/session_description.rs | 2 +- voice-model/src/payload/speaking.rs | 2 +- voice-model/src/protocol_data.rs | 2 +- 44 files changed, 70 insertions(+), 70 deletions(-) diff --git a/command_attr/src/attributes.rs b/command_attr/src/attributes.rs index 3c8fda469f3..4407a97abaa 100644 --- a/command_attr/src/attributes.rs +++ b/command_attr/src/attributes.rs @@ -8,7 +8,7 @@ use syn::{Attribute, Ident, Lit, LitStr, Meta, NestedMeta, Path}; use crate::structures::{Checks, Colour, HelpBehaviour, OnlyIn, Permissions}; use crate::util::{AsOption, LitExt}; -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum ValueKind { // #[] Name, diff --git a/command_attr/src/util.rs b/command_attr/src/util.rs index 9c624cc387f..a44610f8a7d 100644 --- a/command_attr/src/util.rs +++ b/command_attr/src/util.rs @@ -181,7 +181,7 @@ pub fn generate_type_validation(have: &Type, expect: &Type) -> syn::Stmt { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum DeclarFor { Command, Help, diff --git a/src/builder/create_allowed_mentions.rs b/src/builder/create_allowed_mentions.rs index fe42fac8e73..b9c927ea402 100644 --- a/src/builder/create_allowed_mentions.rs +++ b/src/builder/create_allowed_mentions.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use crate::model::id::{RoleId, UserId}; -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[serde(rename_all = "lowercase")] pub enum ParseValue { Everyone, diff --git a/src/client/bridge/gateway/mod.rs b/src/client/bridge/gateway/mod.rs index 459f9f15a1e..59cb6409a2c 100644 --- a/src/client/bridge/gateway/mod.rs +++ b/src/client/bridge/gateway/mod.rs @@ -72,7 +72,7 @@ pub enum ShardClientMessage { } /// A message for a [`ShardManager`] relating to an operation with a shard. -#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub enum ShardManagerMessage { /// Indicator that a [`ShardManagerMonitor`] should restart a shard. Restart(ShardId), diff --git a/src/framework/standard/args.rs b/src/framework/standard/args.rs index 51b0d387db9..fdf6a06aa5f 100644 --- a/src/framework/standard/args.rs +++ b/src/framework/standard/args.rs @@ -80,14 +80,14 @@ impl<'a> From<&'a str> for Delimiter { } } -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq)] #[allow(clippy::enum_variant_names)] enum TokenKind { Argument, QuotedArgument, } -#[derive(Debug, Clone, Copy)] +#[derive(Clone, Copy, Debug)] struct Token { kind: TokenKind, span: (usize, usize), @@ -216,7 +216,7 @@ fn remove_quotes(s: &str) -> &str { strip(s, '\u{201C}', '\u{201D}').unwrap_or(s) } -#[derive(Debug, Clone, Copy)] +#[derive(Clone, Copy, Debug)] enum State { None, Quoted, diff --git a/src/framework/standard/structures/mod.rs b/src/framework/standard/structures/mod.rs index 770865a13cc..101e048569b 100644 --- a/src/framework/standard/structures/mod.rs +++ b/src/framework/standard/structures/mod.rs @@ -16,7 +16,7 @@ mod check; pub use self::check::*; -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] #[non_exhaustive] pub enum OnlyIn { Dm, @@ -128,7 +128,7 @@ impl PartialEq for HelpCommand { /// Lacking required permissions to execute the command. /// Lacking required roles to execute the command. /// The command can't be used in the current channel (as in `DM only` or `guild only`). -#[derive(Copy, Clone, Debug, PartialOrd, Ord, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] #[non_exhaustive] pub enum HelpBehaviour { /// The command will be displayed, hence nothing will be done. diff --git a/src/gateway/mod.rs b/src/gateway/mod.rs index 78aed79534d..4ab3813a5fc 100644 --- a/src/gateway/mod.rs +++ b/src/gateway/mod.rs @@ -66,7 +66,7 @@ pub type CurrentPresence = (Option, OnlineStatus); /// Indicates the current connection stage of a [`Shard`]. /// /// This can be useful for knowing which shards are currently "down"/"up". -#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] pub enum ConnectionStage { /// Indicator that the [`Shard`] is normally connected and is not in, e.g., diff --git a/src/model/application.rs b/src/model/application.rs index 77738bfa99c..7f88edc8c67 100644 --- a/src/model/application.rs +++ b/src/model/application.rs @@ -106,7 +106,7 @@ pub struct TeamMember { } /// [Discord docs](https://discord.com/developers/docs/topics/teams#data-models-membership-state-enum). -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] pub enum MembershipState { Invited = 1, diff --git a/src/model/application/command.rs b/src/model/application/command.rs index 8fa3e47d8ea..f0794ac8e44 100644 --- a/src/model/application/command.rs +++ b/src/model/application/command.rs @@ -246,7 +246,7 @@ impl Command { /// The type of an application command. /// /// [Discord docs](https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types). -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] #[repr(u8)] pub enum CommandType { @@ -324,7 +324,7 @@ pub struct CommandOption { /// The type of an [`CommandOption`]. /// /// [Discord docs](https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type). -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] #[repr(u8)] pub enum CommandOptionType { @@ -405,7 +405,7 @@ pub struct CommandPermissionData { /// The type of an [`CommandPermissionData`]. /// /// [Discord docs](https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type). -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] #[repr(u8)] pub enum CommandPermissionType { diff --git a/src/model/application/component.rs b/src/model/application/component.rs index 5f100ffe60a..5e909ff333c 100644 --- a/src/model/application/component.rs +++ b/src/model/application/component.rs @@ -7,7 +7,7 @@ use crate::model::channel::ReactionType; use crate::model::utils::deserialize_val; /// The type of a component -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] #[repr(u8)] pub enum ComponentType { @@ -105,7 +105,7 @@ pub struct Button { } /// The style of a button. -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] #[repr(u8)] pub enum ButtonStyle { @@ -176,7 +176,7 @@ pub struct InputText { } /// The style of the input text -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] #[repr(u8)] pub enum InputTextStyle { diff --git a/src/model/application/interaction/mod.rs b/src/model/application/interaction/mod.rs index 14fd09fe862..4f157620f5e 100644 --- a/src/model/application/interaction/mod.rs +++ b/src/model/application/interaction/mod.rs @@ -186,7 +186,7 @@ impl Serialize for Interaction { /// The type of an Interaction. /// /// [Discord docs](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type). -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] #[repr(u8)] pub enum InteractionType { @@ -226,7 +226,7 @@ bitflags! { /// [`Message`]: crate::model::channel::Message /// /// [Discord docs](https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object). -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[non_exhaustive] pub struct MessageInteraction { /// The id of the interaction. @@ -248,7 +248,7 @@ pub struct MessageInteraction { /// The available responses types for an interaction response. /// /// [Discord docs](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type). -#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] #[repr(u8)] pub enum InteractionResponseType { diff --git a/src/model/application/interaction/ping.rs b/src/model/application/interaction/ping.rs index 7a3b1604f0e..5c4616dd1cc 100644 --- a/src/model/application/interaction/ping.rs +++ b/src/model/application/interaction/ping.rs @@ -5,7 +5,7 @@ use crate::model::id::{ApplicationId, InteractionId}; /// A ping interaction, which can only be received through an endpoint url. /// /// [Discord docs](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure). -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[non_exhaustive] pub struct PingInteraction { /// Id of the interaction. diff --git a/src/model/application/oauth.rs b/src/model/application/oauth.rs index 91a883ab322..09a324738c0 100644 --- a/src/model/application/oauth.rs +++ b/src/model/application/oauth.rs @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize}; /// /// [Discord docs](https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes). #[non_exhaustive] -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Deserialize, Serialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize, Serialize)] pub enum Scope { /// For oauth2 bots, this puts the bot in the user's selected guild by default. #[serde(rename = "bot")] diff --git a/src/model/channel/mod.rs b/src/model/channel/mod.rs index 718fccfbc2a..d2791f02027 100644 --- a/src/model/channel/mod.rs +++ b/src/model/channel/mod.rs @@ -354,7 +354,7 @@ impl ChannelType { } /// [Discord docs](https://discord.com/developers/docs/resources/channel#overwrite-object). -#[derive(Debug, Clone, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub(crate) struct PermissionOverwriteData { allow: Permissions, deny: Permissions, @@ -431,7 +431,7 @@ impl Serialize for PermissionOverwrite { /// This is for use with methods such as [`GuildChannel::create_permission`]. /// /// [Discord docs](https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure) (field `type`). -#[derive(Copy, Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] #[non_exhaustive] pub enum PermissionOverwriteType { /// A member which is having its permission overwrites edited. diff --git a/src/model/channel/partial_channel.rs b/src/model/channel/partial_channel.rs index 13d1038b452..66a765f3271 100644 --- a/src/model/channel/partial_channel.rs +++ b/src/model/channel/partial_channel.rs @@ -5,7 +5,7 @@ use crate::model::Permissions; /// A container for any partial channel. /// /// [Discord docs](https://discord.com/developers/docs/resources/channel#channel-object), [subset specification](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure). -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[non_exhaustive] pub struct PartialChannel { /// The channel Id. @@ -22,7 +22,7 @@ pub struct PartialChannel { /// A container for the IDs returned by following a news channel. /// /// [Discord docs](https://discord.com/developers/docs/resources/channel#followed-channel-object). -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[non_exhaustive] pub struct FollowedChannel { /// The source news channel diff --git a/src/model/connection.rs b/src/model/connection.rs index 37a140a1cc9..f9770c94005 100644 --- a/src/model/connection.rs +++ b/src/model/connection.rs @@ -36,7 +36,7 @@ pub struct Connection { /// The visibility of a user connection on a user's profile. /// /// [Discord docs](https://discord.com/developers/docs/resources/user#connection-object-visibility-types). -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] #[repr(u8)] pub enum ConnectionVisibility { diff --git a/src/model/event.rs b/src/model/event.rs index 1222345d6b8..902e202925d 100644 --- a/src/model/event.rs +++ b/src/model/event.rs @@ -1566,7 +1566,7 @@ impl TryFrom> for Option { /// [`EventType::ChannelCreate`]. /// /// [Discord docs](https://discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events). -#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] #[non_exhaustive] pub enum EventType { /// Indicator that an application command permission update payload was received. diff --git a/src/model/gateway.rs b/src/model/gateway.rs index bad2f8c029f..7ed12106f9e 100644 --- a/src/model/gateway.rs +++ b/src/model/gateway.rs @@ -350,7 +350,7 @@ pub struct ActivityEmoji { } /// [Discord docs](https://discord.com/developers/docs/topics/gateway#activity-object-activity-types). -#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] pub enum ActivityType { /// An indicator that the user is playing a game. diff --git a/src/model/guild/audit_log.rs b/src/model/guild/audit_log.rs index 32c1f127382..2d71e48c042 100644 --- a/src/model/guild/audit_log.rs +++ b/src/model/guild/audit_log.rs @@ -17,7 +17,7 @@ use crate::model::prelude::*; /// Determines the action that was done on a target. /// /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] pub enum Action { GuildUpdate, @@ -98,7 +98,7 @@ impl Serialize for Action { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum ChannelAction { @@ -108,7 +108,7 @@ pub enum ChannelAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum ChannelOverwriteAction { @@ -118,7 +118,7 @@ pub enum ChannelOverwriteAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum MemberAction { @@ -134,7 +134,7 @@ pub enum MemberAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum RoleAction { @@ -144,7 +144,7 @@ pub enum RoleAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum InviteAction { @@ -154,7 +154,7 @@ pub enum InviteAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum WebhookAction { @@ -164,7 +164,7 @@ pub enum WebhookAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum EmojiAction { @@ -174,7 +174,7 @@ pub enum EmojiAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum MessageAction { @@ -185,7 +185,7 @@ pub enum MessageAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum IntegrationAction { @@ -195,7 +195,7 @@ pub enum IntegrationAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum StageInstanceAction { @@ -205,7 +205,7 @@ pub enum StageInstanceAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum StickerAction { @@ -215,7 +215,7 @@ pub enum StickerAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum ScheduledEventAction { @@ -225,7 +225,7 @@ pub enum ScheduledEventAction { } /// [Discord docs](https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events). -#[derive(Copy, Clone, Debug)] +#[derive(Clone, Copy, Debug)] #[non_exhaustive] #[repr(u8)] pub enum ThreadAction { diff --git a/src/model/guild/guild_id.rs b/src/model/guild/guild_id.rs index 2a73b1846ab..b7fe1a3fadb 100644 --- a/src/model/guild/guild_id.rs +++ b/src/model/guild/guild_id.rs @@ -1835,7 +1835,7 @@ impl> MembersIter { } } -#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] #[non_exhaustive] pub enum GuildWidgetStyle { Shield, diff --git a/src/model/guild/integration.rs b/src/model/guild/integration.rs index c6d4cc3d860..ba9a1218d38 100644 --- a/src/model/guild/integration.rs +++ b/src/model/guild/integration.rs @@ -30,7 +30,7 @@ pub struct Integration { /// The behavior once the integration expires. /// /// [Discord docs](https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors). -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] #[repr(u8)] pub enum IntegrationExpireBehaviour { diff --git a/src/model/guild/premium_tier.rs b/src/model/guild/premium_tier.rs index 9933e6d6784..68fcd40b9dd 100644 --- a/src/model/guild/premium_tier.rs +++ b/src/model/guild/premium_tier.rs @@ -1,7 +1,7 @@ /// The guild's premium tier, depends on the amount of users boosting the guild currently /// /// [Discord docs](https://discord.com/developers/docs/resources/guild#guild-object-premium-tier). -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] pub enum PremiumTier { /// No tier, considered None diff --git a/src/model/guild/scheduled_event.rs b/src/model/guild/scheduled_event.rs index dd8b0ca1b78..fb2c3d247d3 100644 --- a/src/model/guild/scheduled_event.rs +++ b/src/model/guild/scheduled_event.rs @@ -49,7 +49,7 @@ pub struct ScheduledEvent { } /// [Discord docs](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-status). -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] pub enum ScheduledEventStatus { Scheduled = 1, @@ -67,7 +67,7 @@ enum_number!(ScheduledEventStatus { }); /// [Discord docs](https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event-object-guild-scheduled-event-entity-types). -#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] #[non_exhaustive] pub enum ScheduledEventType { StageInstance = 1, diff --git a/src/model/mention.rs b/src/model/mention.rs index a14ea66a69a..bc221e177bc 100644 --- a/src/model/mention.rs +++ b/src/model/mention.rs @@ -88,7 +88,7 @@ pub trait Mentionable { /// format!("{} {} {}", Mention::from(user), Mention::from(channel), Mention::from(role),), /// ) /// ``` -#[derive(Debug, Clone, Copy)] +#[derive(Clone, Copy, Debug)] pub enum Mention { Channel(ChannelId), Role(RoleId), diff --git a/src/model/misc.rs b/src/model/misc.rs index f0cc263ad2e..63119b55526 100644 --- a/src/model/misc.rs +++ b/src/model/misc.rs @@ -151,7 +151,7 @@ pub struct IncidentUpdate { } /// The type of status update during a service incident. -#[derive(Copy, Clone, Debug, Deserialize, Hash, Eq, PartialEq, PartialOrd, Ord, Serialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize, Serialize)] #[non_exhaustive] #[serde(rename_all = "snake_case")] pub enum IncidentStatus { diff --git a/src/model/user.rs b/src/model/user.rs index 192f73f4658..bc4dd3fde4e 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -553,7 +553,7 @@ impl Default for CurrentUser { /// The default avatar is calculated via the result of `discriminator % 5`. /// /// The has of the avatar can be retrieved via calling [`Self::name`] on the enum. -#[derive(Copy, Clone, Debug, Deserialize, Hash, Eq, PartialEq, PartialOrd, Ord, Serialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize, Serialize)] #[non_exhaustive] pub enum DefaultAvatar { /// The avatar when the result is `0`. @@ -587,7 +587,7 @@ impl DefaultAvatar { /// The representation of a user's status. /// /// [Discord docs](https://discord.com/developers/docs/topics/gateway#update-presence-status-types). -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, PartialOrd, Ord, Serialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize, Serialize)] #[non_exhaustive] pub enum OnlineStatus { #[serde(rename = "dnd")] diff --git a/src/utils/argument_convert/_template.rs b/src/utils/argument_convert/_template.rs index aacc00481d9..2760f1cba45 100644 --- a/src/utils/argument_convert/_template.rs +++ b/src/utils/argument_convert/_template.rs @@ -4,7 +4,7 @@ use crate::{model::prelude::*, prelude::*}; /// Error that can be returned from [`PLACEHOLDER::convert`]. #[non_exhaustive] -#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum PLACEHOLDERParseError { } diff --git a/src/utils/argument_convert/emoji.rs b/src/utils/argument_convert/emoji.rs index 52ca1563710..7f51664af88 100644 --- a/src/utils/argument_convert/emoji.rs +++ b/src/utils/argument_convert/emoji.rs @@ -6,7 +6,7 @@ use crate::prelude::*; /// Error that can be returned from [`Emoji::convert`]. #[non_exhaustive] -#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum EmojiParseError { /// Parser was invoked outside a guild. OutsideGuild, diff --git a/src/utils/argument_convert/guild.rs b/src/utils/argument_convert/guild.rs index 09c3fbd24db..9b0bea0dae2 100644 --- a/src/utils/argument_convert/guild.rs +++ b/src/utils/argument_convert/guild.rs @@ -9,7 +9,7 @@ use crate::prelude::*; /// Error that can be returned from [`Guild::convert`]. #[non_exhaustive] -#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum GuildParseError { /// The provided guild string failed to parse, or the parsed result cannot be found in the /// cache. diff --git a/src/utils/argument_convert/member.rs b/src/utils/argument_convert/member.rs index 85fd6ecd414..c73c6025251 100644 --- a/src/utils/argument_convert/member.rs +++ b/src/utils/argument_convert/member.rs @@ -6,7 +6,7 @@ use crate::prelude::*; /// Error that can be returned from [`Member::convert`]. #[non_exhaustive] -#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum MemberParseError { /// Parser was invoked outside a guild. OutsideGuild, diff --git a/src/utils/argument_convert/user.rs b/src/utils/argument_convert/user.rs index 09c90b56150..1274f8477ed 100644 --- a/src/utils/argument_convert/user.rs +++ b/src/utils/argument_convert/user.rs @@ -6,7 +6,7 @@ use crate::prelude::*; /// Error that can be returned from [`User::convert`]. #[non_exhaustive] -#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum UserParseError { /// The provided user string failed to parse, or the parsed result cannot be found in the /// guild cache data. diff --git a/voice-model/src/close_code.rs b/voice-model/src/close_code.rs index 39d8a34df2e..e8f55a91079 100644 --- a/voice-model/src/close_code.rs +++ b/voice-model/src/close_code.rs @@ -2,7 +2,7 @@ use enum_primitive::*; enum_from_primitive! { /// Discord Voice Gateway Websocket close codes. -#[derive(Copy, Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum CloseCode { /// Invalid Voice OP Code. UnknownOpcode = 4001, diff --git a/voice-model/src/opcode.rs b/voice-model/src/opcode.rs index d38b414e4db..b70a0cdd486 100644 --- a/voice-model/src/opcode.rs +++ b/voice-model/src/opcode.rs @@ -4,7 +4,7 @@ use serde_repr::{Deserialize_repr, Serialize_repr}; /// /// [voice opcodes]: https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice #[derive( - Clone, Copy, Debug, Deserialize_repr, Eq, Hash, PartialEq, PartialOrd, Ord, Serialize_repr, + Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize_repr, Serialize_repr, )] #[non_exhaustive] #[repr(u8)] diff --git a/voice-model/src/payload/client_connect.rs b/voice-model/src/payload/client_connect.rs index 832a8dda579..59e60a7d8fd 100644 --- a/voice-model/src/payload/client_connect.rs +++ b/voice-model/src/payload/client_connect.rs @@ -5,7 +5,7 @@ use crate::id::UserId; /// Message indicating that another user has connected to the voice channel. /// /// Acts as a source of UserId+SSRC identification. -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] pub struct ClientConnect { /// SSRC of any audio packets sent by this newly joined user. pub audio_ssrc: u32, diff --git a/voice-model/src/payload/client_disconnect.rs b/voice-model/src/payload/client_disconnect.rs index 4dc85f05fa1..2458ea26df6 100644 --- a/voice-model/src/payload/client_disconnect.rs +++ b/voice-model/src/payload/client_disconnect.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use crate::id::UserId; /// Message indicating that another user has disconnected from the voice channel. -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] pub struct ClientDisconnect { /// Id of the disconnected user. pub user_id: UserId, diff --git a/voice-model/src/payload/heartbeat.rs b/voice-model/src/payload/heartbeat.rs index 20c99164dc4..f010c6acb52 100644 --- a/voice-model/src/payload/heartbeat.rs +++ b/voice-model/src/payload/heartbeat.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use crate::util::json_safe_u64; /// Used to keep the websocket connection alive. -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] #[serde(transparent)] pub struct Heartbeat { /// Random number generated by the client, to be mirrored by the server. diff --git a/voice-model/src/payload/heartbeat_ack.rs b/voice-model/src/payload/heartbeat_ack.rs index 3eebf40aefc..e69555322a2 100644 --- a/voice-model/src/payload/heartbeat_ack.rs +++ b/voice-model/src/payload/heartbeat_ack.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use crate::util::json_safe_u64; /// Heartbeat ACK, received by the client to show the server's receipt of a heartbeat. -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] #[serde(transparent)] pub struct HeartbeatAck { /// Random 64-bit number previously generated by the client, mirrored by the server. diff --git a/voice-model/src/payload/identify.rs b/voice-model/src/payload/identify.rs index 365dcd0637e..8dea19f6620 100644 --- a/voice-model/src/payload/identify.rs +++ b/voice-model/src/payload/identify.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use crate::id::*; /// Used to begin a voice websocket connection. -#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] pub struct Identify { /// GuildId which the target voice channel belongs to. pub server_id: GuildId, diff --git a/voice-model/src/payload/ready.rs b/voice-model/src/payload/ready.rs index 23d28a217fe..43c549f5dc7 100644 --- a/voice-model/src/payload/ready.rs +++ b/voice-model/src/payload/ready.rs @@ -3,7 +3,7 @@ use std::net::IpAddr; use serde::{Deserialize, Serialize}; /// RTP server's connection offer and supported encryption modes. -#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] pub struct Ready { /// IP address of the call's allocated RTP server. pub ip: IpAddr, diff --git a/voice-model/src/payload/resume.rs b/voice-model/src/payload/resume.rs index b5cc72674c3..007ac848ff1 100644 --- a/voice-model/src/payload/resume.rs +++ b/voice-model/src/payload/resume.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use crate::id::GuildId; /// Sent by the client after a disconnect to attempt to resume a session. -#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] pub struct Resume { /// GuildId which the target voice channel belongs to. pub server_id: GuildId, diff --git a/voice-model/src/payload/select_protocol.rs b/voice-model/src/payload/select_protocol.rs index 31a58013ed8..29703d027ad 100644 --- a/voice-model/src/payload/select_protocol.rs +++ b/voice-model/src/payload/select_protocol.rs @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize}; use crate::protocol_data::ProtocolData; /// Used to select the voice protocol and encryption mechanism. -#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] pub struct SelectProtocol { /// Client's response to encryption/connection negotiation. pub data: ProtocolData, diff --git a/voice-model/src/payload/session_description.rs b/voice-model/src/payload/session_description.rs index 713e9489b10..c63e4c67148 100644 --- a/voice-model/src/payload/session_description.rs +++ b/voice-model/src/payload/session_description.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Serialize}; /// Server's confirmation of a negotiated encryption scheme. -#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] pub struct SessionDescription { /// The negotiated encryption mode. pub mode: String, diff --git a/voice-model/src/payload/speaking.rs b/voice-model/src/payload/speaking.rs index 9a6e4a09b16..be6d4fed74d 100644 --- a/voice-model/src/payload/speaking.rs +++ b/voice-model/src/payload/speaking.rs @@ -4,7 +4,7 @@ use crate::id::UserId; use crate::speaking_state::SpeakingState; /// Used to indicate which users are speaking, or to inform Discord that the client is now speaking. -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] pub struct Speaking { /// Function currently unknown. /// diff --git a/voice-model/src/protocol_data.rs b/voice-model/src/protocol_data.rs index ec6cf14d44c..c84cce7e259 100644 --- a/voice-model/src/protocol_data.rs +++ b/voice-model/src/protocol_data.rs @@ -3,7 +3,7 @@ use std::net::IpAddr; use serde::{Deserialize, Serialize}; /// The client's response to a connection offer. -#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] +#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)] pub struct ProtocolData { /// IP address of the client as seen by the server (*e.g.*, after using [IP Discovery] /// for NAT hole-punching).