unconditionally derive Debug on subcommand enums

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-24 00:13:03 +00:00
parent f841c2356d
commit 2468e0c3de
11 changed files with 24 additions and 47 deletions

View file

@ -8,7 +8,7 @@ use crate::{
server, server::ServerCommand, user, user::UserCommand, server, server::ServerCommand, user, user::UserCommand,
}; };
#[derive(Parser)] #[derive(Debug, Parser)]
#[command(name = "admin", version = env!("CARGO_PKG_VERSION"))] #[command(name = "admin", version = env!("CARGO_PKG_VERSION"))]
pub(crate) enum AdminCommand { pub(crate) enum AdminCommand {
#[command(subcommand)] #[command(subcommand)]

View file

@ -6,8 +6,7 @@ use ruma::events::room::message::RoomMessageEventContent;
use self::commands::*; use self::commands::*;
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum AppserviceCommand { pub(super) enum AppserviceCommand {
/// - Register an appservice using its registration YAML /// - Register an appservice using its registration YAML
/// ///

View file

@ -6,8 +6,7 @@ use ruma::events::room::message::RoomMessageEventContent;
use self::commands::*; use self::commands::*;
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum CheckCommand { pub(super) enum CheckCommand {
AllUsers, AllUsers,
} }

View file

@ -8,8 +8,7 @@ use tester::TesterCommand;
use self::commands::*; use self::commands::*;
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum DebugCommand { pub(super) enum DebugCommand {
/// - Echo input of admin command /// - Echo input of admin command
Echo { Echo {

View file

@ -2,8 +2,7 @@ use ruma::events::room::message::RoomMessageEventContent;
use crate::Result; use crate::Result;
#[derive(clap::Subcommand)] #[derive(Debug, clap::Subcommand)]
#[cfg_attr(test, derive(Debug))]
pub(crate) enum TesterCommand { pub(crate) enum TesterCommand {
Tester, Tester,
Timer, Timer,

View file

@ -6,8 +6,7 @@ use ruma::{events::room::message::RoomMessageEventContent, RoomId, ServerName, U
use self::commands::*; use self::commands::*;
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum FederationCommand { pub(super) enum FederationCommand {
/// - List all rooms we are currently handling an incoming pdu from /// - List all rooms we are currently handling an incoming pdu from
IncomingFederation, IncomingFederation,

View file

@ -6,8 +6,7 @@ use ruma::{events::room::message::RoomMessageEventContent, EventId, MxcUri};
use self::commands::*; use self::commands::*;
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum MediaCommand { pub(super) enum MediaCommand {
/// - Deletes a single media file from our database and on the filesystem /// - Deletes a single media file from our database and on the filesystem
/// via a single MXC URL /// via a single MXC URL

View file

@ -21,8 +21,7 @@ use self::{
room_alias::room_alias, sending::sending, users::users, room_alias::room_alias, sending::sending, users::users,
}; };
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
/// Query tables from database /// Query tables from database
pub(super) enum QueryCommand { pub(super) enum QueryCommand {
/// - account_data.rs iterators and getters /// - account_data.rs iterators and getters
@ -62,8 +61,7 @@ pub(super) enum QueryCommand {
Resolver(Resolver), Resolver(Resolver),
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
/// All the getters and iterators from src/database/key_value/account_data.rs /// All the getters and iterators from src/database/key_value/account_data.rs
pub(super) enum AccountData { pub(super) enum AccountData {
/// - Returns all changes to the account data that happened after `since`. /// - Returns all changes to the account data that happened after `since`.
@ -87,8 +85,7 @@ pub(super) enum AccountData {
}, },
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
/// All the getters and iterators from src/database/key_value/appservice.rs /// All the getters and iterators from src/database/key_value/appservice.rs
pub(super) enum Appservice { pub(super) enum Appservice {
/// - Gets the appservice registration info/details from the ID as a string /// - Gets the appservice registration info/details from the ID as a string
@ -101,8 +98,7 @@ pub(super) enum Appservice {
All, All,
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
/// All the getters and iterators from src/database/key_value/presence.rs /// All the getters and iterators from src/database/key_value/presence.rs
pub(super) enum Presence { pub(super) enum Presence {
/// - Returns the latest presence event for the given user. /// - Returns the latest presence event for the given user.
@ -119,8 +115,7 @@ pub(super) enum Presence {
}, },
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
/// All the getters and iterators from src/database/key_value/rooms/alias.rs /// All the getters and iterators from src/database/key_value/rooms/alias.rs
pub(super) enum RoomAlias { pub(super) enum RoomAlias {
ResolveLocalAlias { ResolveLocalAlias {
@ -138,8 +133,7 @@ pub(super) enum RoomAlias {
AllLocalAliases, AllLocalAliases,
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum RoomStateCache { pub(super) enum RoomStateCache {
ServerInRoom { ServerInRoom {
server: Box<ServerName>, server: Box<ServerName>,
@ -210,8 +204,7 @@ pub(super) enum RoomStateCache {
}, },
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
/// All the getters and iterators from src/database/key_value/globals.rs /// All the getters and iterators from src/database/key_value/globals.rs
pub(super) enum Globals { pub(super) enum Globals {
DatabaseVersion, DatabaseVersion,
@ -229,8 +222,7 @@ pub(super) enum Globals {
}, },
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
/// All the getters and iterators from src/database/key_value/sending.rs /// All the getters and iterators from src/database/key_value/sending.rs
pub(super) enum Sending { pub(super) enum Sending {
/// - Queries database for all `servercurrentevent_data` /// - Queries database for all `servercurrentevent_data`
@ -285,15 +277,13 @@ pub(super) enum Sending {
}, },
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
/// All the getters and iterators from src/database/key_value/users.rs /// All the getters and iterators from src/database/key_value/users.rs
pub(super) enum Users { pub(super) enum Users {
Iter, Iter,
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
/// Resolver service and caches /// Resolver service and caches
pub(super) enum Resolver { pub(super) enum Resolver {
/// Query the destinations cache /// Query the destinations cache

View file

@ -10,8 +10,7 @@ use ruma::{events::room::message::RoomMessageEventContent, RoomId, RoomOrAliasId
use self::room_commands::list; use self::room_commands::list;
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum RoomCommand { pub(super) enum RoomCommand {
/// - List all rooms the server knows about /// - List all rooms the server knows about
List { List {
@ -43,8 +42,7 @@ pub(super) enum RoomCommand {
Directory(RoomDirectoryCommand), Directory(RoomDirectoryCommand),
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum RoomInfoCommand { pub(super) enum RoomInfoCommand {
/// - List joined members in a room /// - List joined members in a room
ListJoinedMembers { ListJoinedMembers {
@ -60,8 +58,7 @@ pub(super) enum RoomInfoCommand {
}, },
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum RoomAliasCommand { pub(super) enum RoomAliasCommand {
/// - Make an alias point to a room. /// - Make an alias point to a room.
Set { Set {
@ -96,8 +93,7 @@ pub(super) enum RoomAliasCommand {
}, },
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum RoomDirectoryCommand { pub(super) enum RoomDirectoryCommand {
/// - Publish a room to the room directory /// - Publish a room to the room directory
Publish { Publish {
@ -117,8 +113,7 @@ pub(super) enum RoomDirectoryCommand {
}, },
} }
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum RoomModerationCommand { pub(super) enum RoomModerationCommand {
/// - Bans a room from local users joining and evicts all our local users /// - Bans a room from local users joining and evicts all our local users
/// from the room. Also blocks any invites (local and remote) for the /// from the room. Also blocks any invites (local and remote) for the

View file

@ -6,8 +6,7 @@ use ruma::events::room::message::RoomMessageEventContent;
use self::commands::*; use self::commands::*;
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum ServerCommand { pub(super) enum ServerCommand {
/// - Time elapsed since startup /// - Time elapsed since startup
Uptime, Uptime,

View file

@ -6,8 +6,7 @@ use ruma::{events::room::message::RoomMessageEventContent, OwnedRoomOrAliasId, R
use self::commands::*; use self::commands::*;
#[cfg_attr(test, derive(Debug))] #[derive(Debug, Subcommand)]
#[derive(Subcommand)]
pub(super) enum UserCommand { pub(super) enum UserCommand {
/// - Create a new user /// - Create a new user
Create { Create {