Skip to content

Commit

Permalink
Group & sort derive macros alphabetically
Browse files Browse the repository at this point in the history
The derive macros are grouped into `std` & third party and
sorted alphabetically.

```
struct Foo;
```
  • Loading branch information
nickelc authored and kangalio committed Sep 11, 2022
1 parent 00362d7 commit 6f7442e
Show file tree
Hide file tree
Showing 44 changed files with 70 additions and 70 deletions.
2 changes: 1 addition & 1 deletion command_attr/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>]
Name,
Expand Down
2 changes: 1 addition & 1 deletion command_attr/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/builder/create_allowed_mentions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/client/bridge/gateway/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
6 changes: 3 additions & 3 deletions src/framework/standard/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/framework/standard/structures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/gateway/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub type CurrentPresence = (Option<Activity>, 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.,
Expand Down
2 changes: 1 addition & 1 deletion src/model/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/model/application/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/model/application/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/model/application/interaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/model/application/interaction/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/model/application/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
4 changes: 2 additions & 2 deletions src/model/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/model/channel/partial_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/model/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/model/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ impl<T> TryFrom<RelatedId<T>> for Option<T> {
/// [`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.
Expand Down
2 changes: 1 addition & 1 deletion src/model/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
28 changes: 14 additions & 14 deletions src/model/guild/audit_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/model/guild/guild_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ impl<H: AsRef<Http>> MembersIter<H> {
}
}

#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)]
#[non_exhaustive]
pub enum GuildWidgetStyle {
Shield,
Expand Down
Loading

0 comments on commit 6f7442e

Please sign in to comment.