diff --git a/crates/command_definitions/src/admin.rs b/crates/command_definitions/src/admin.rs index 24608f58..00da3289 100644 --- a/crates/command_definitions/src/admin.rs +++ b/crates/command_definitions/src/admin.rs @@ -4,7 +4,7 @@ pub fn admin() -> &'static str { "admin" } -pub fn cmds() -> impl Iterator { +pub fn cmds() -> impl IntoIterator { let admin = admin(); let abuselog = tokens!(admin, ("abuselog", ["al"])); @@ -24,7 +24,7 @@ pub fn cmds() -> impl Iterator { .help("Removes a user from an abuse log entry"), command!(abuselog, ("delete", ["d"]), log_param => format!("admin_abuselog_delete_{}", log_param.name())) .help("Deletes an abuse log entry"), - ].into_iter() + ] }; let abuselog_cmds = [ command!(abuselog, ("create", ["c", "new"]), ("account", UserRef), Optional(Remainder(("description", OpaqueString))) => "admin_abuselog_create") diff --git a/crates/command_definitions/src/api.rs b/crates/command_definitions/src/api.rs index e9cd5746..d2e669b9 100644 --- a/crates/command_definitions/src/api.rs +++ b/crates/command_definitions/src/api.rs @@ -1,9 +1,8 @@ use super::*; -pub fn cmds() -> impl Iterator { +pub fn cmds() -> impl IntoIterator { [ command!("token" => "token_display"), command!("token", ("refresh", ["renew", "regen", "reroll"]) => "token_refresh"), ] - .into_iter() } diff --git a/crates/command_definitions/src/autoproxy.rs b/crates/command_definitions/src/autoproxy.rs index 68a1925b..f7d4e5dc 100644 --- a/crates/command_definitions/src/autoproxy.rs +++ b/crates/command_definitions/src/autoproxy.rs @@ -4,7 +4,7 @@ pub fn autoproxy() -> (&'static str, [&'static str; 2]) { ("autoproxy", ["ap", "auto"]) } -pub fn cmds() -> impl Iterator { +pub fn cmds() -> impl IntoIterator { let ap = autoproxy(); [ @@ -17,5 +17,4 @@ pub fn cmds() -> impl Iterator { .help("Sets autoproxy to front mode"), command!(ap, MemberRef => "autoproxy_member").help("Sets autoproxy to a specific member"), ] - .into_iter() } diff --git a/crates/command_definitions/src/config.rs b/crates/command_definitions/src/config.rs index af63e633..87741f86 100644 --- a/crates/command_definitions/src/config.rs +++ b/crates/command_definitions/src/config.rs @@ -2,7 +2,7 @@ use command_parser::parameter; use super::*; -pub fn cmds() -> impl Iterator { +pub fn cmds() -> impl IntoIterator { let cfg = ("config", ["cfg", "configure"]); let ap = tokens!(cfg, ("autoproxy", ["ap"])); @@ -198,5 +198,4 @@ pub fn cmds() -> impl Iterator { command!(group_limit => "cfg_limits_update").help("Refreshes member/group limits"), command!(limit => "cfg_limits_update").help("Refreshes member/group limits"), ] - .into_iter() } diff --git a/crates/command_definitions/src/debug.rs b/crates/command_definitions/src/debug.rs index 36f0e224..afd204e4 100644 --- a/crates/command_definitions/src/debug.rs +++ b/crates/command_definitions/src/debug.rs @@ -4,7 +4,7 @@ pub fn debug() -> (&'static str, [&'static str; 1]) { ("debug", ["dbg"]) } -pub fn cmds() -> impl Iterator { +pub fn cmds() -> impl IntoIterator { let debug = debug(); let perms = ("permissions", ["perms", "permcheck"]); [ @@ -12,5 +12,4 @@ pub fn cmds() -> impl Iterator { command!(debug, perms, ("guild", ["g"]), GuildRef => "permcheck_guild"), command!(debug, ("proxy", ["proxying", "proxycheck"]), MessageRef => "message_proxy_check"), ] - .into_iter() } diff --git a/crates/command_definitions/src/fun.rs b/crates/command_definitions/src/fun.rs index f16c09e1..9c0e80e4 100644 --- a/crates/command_definitions/src/fun.rs +++ b/crates/command_definitions/src/fun.rs @@ -1,6 +1,6 @@ use super::*; -pub fn cmds() -> impl Iterator { +pub fn cmds() -> impl IntoIterator { [ command!("thunder" => "fun_thunder"), command!("meow" => "fun_meow"), @@ -13,5 +13,4 @@ pub fn cmds() -> impl Iterator { command!("sus" => "amogus"), command!("error" => "fun_error"), ] - .into_iter() } diff --git a/crates/command_definitions/src/group.rs b/crates/command_definitions/src/group.rs index 24ab6f96..3d845b90 100644 --- a/crates/command_definitions/src/group.rs +++ b/crates/command_definitions/src/group.rs @@ -19,16 +19,16 @@ pub fn cmds() -> impl Iterator { let group_target = targeted(); let group_new = tokens!(group, ("new", ["n"])); - let group_new_cmd = [ + let group_new_cmd = once( command!(group_new, Remainder(("name", OpaqueString)) => "group_new") .help("Creates a new group"), - ] - .into_iter(); + ); - let group_info_cmd = [command!(group_target => "group_info") - .flag(ALL) - .help("Shows information about a group")] - .into_iter(); + let group_info_cmd = once( + command!(group_target => "group_info") + .flag(ALL) + .help("Shows information about a group"), + ); let group_name = tokens!( group_target, @@ -41,8 +41,7 @@ pub fn cmds() -> impl Iterator { .help("Clears the group's name"), command!(group_name, Remainder(("name", OpaqueString)) => "group_rename") .help("Renames the group"), - ] - .into_iter(); + ]; let group_display_name = tokens!(group_target, ("displayname", ["dn", "nick", "nickname"])); let group_display_name_cmd = [ @@ -53,8 +52,7 @@ pub fn cmds() -> impl Iterator { .help("Clears the group's display name"), command!(group_display_name, Remainder(("name", OpaqueString)) => "group_change_display_name") .help("Changes the group's display name"), - ] - .into_iter(); + ]; let group_description = tokens!( group_target, @@ -71,8 +69,7 @@ pub fn cmds() -> impl Iterator { .help("Clears the group's description"), command!(group_description, Remainder(("description", OpaqueString)) => "group_change_description") .help("Changes the group's description"), - ] - .into_iter(); + ]; let group_icon = tokens!( group_target, @@ -85,8 +82,7 @@ pub fn cmds() -> impl Iterator { .help("Clears the group's icon"), command!(group_icon, ("icon", Avatar) => "group_change_icon") .help("Changes the group's icon"), - ] - .into_iter(); + ]; let group_banner = tokens!(group_target, ("banner", ["splash", "cover"])); let group_banner_cmd = [ @@ -96,8 +92,7 @@ pub fn cmds() -> impl Iterator { .help("Clears the group's banner"), command!(group_banner, ("banner", Avatar) => "group_change_banner") .help("Changes the group's banner"), - ] - .into_iter(); + ]; let group_color = tokens!(group_target, ("color", ["colour"])); let group_color_cmd = [ @@ -107,8 +102,7 @@ pub fn cmds() -> impl Iterator { .help("Clears the group's color"), command!(group_color, ("color", OpaqueString) => "group_change_color") .help("Changes the group's color"), - ] - .into_iter(); + ]; let group_privacy = tokens!(group_target, ("privacy", ["priv"])); let group_privacy_cmd = [ @@ -118,30 +112,25 @@ pub fn cmds() -> impl Iterator { .help("Changes all privacy settings for the group"), command!(group_privacy, ("privacy", GroupPrivacyTarget), ("level", PrivacyLevel) => "group_change_privacy") .help("Changes a specific privacy setting for the group"), - ] - .into_iter(); + ]; let group_public_cmd = [ command!(group_target, ("public", ["pub"]) => "group_set_public") .help("Sets the group to public"), - ] - .into_iter(); + ]; let group_private_cmd = [ command!(group_target, ("private", ["priv"]) => "group_set_private") .help("Sets the group to private"), - ] - .into_iter(); + ]; let group_delete_cmd = [ command!(group_target, ("delete", ["destroy", "erase", "yeet"]) => "group_delete") .flag(YES) .help("Deletes the group"), - ] - .into_iter(); + ]; - let group_id_cmd = - [command!(group_target, "id" => "group_id").help("Shows the group's ID")].into_iter(); + let group_id_cmd = [command!(group_target, "id" => "group_id").help("Shows the group's ID")]; let group_front = tokens!(group_target, ("front", ["fronter", "fronters", "f"])); let group_front_cmd = [ @@ -149,8 +138,7 @@ pub fn cmds() -> impl Iterator { .flag(("duration", OpaqueString)) .flag(("fronters-only", ["fo"])) .flag("flat"), - ] - .into_iter(); + ]; let apply_list_opts = |cmd: Command| cmd.flags(get_list_flags()); let search_param = Optional(Remainder(("query", OpaqueString))); @@ -164,8 +152,7 @@ pub fn cmds() -> impl Iterator { .flag(ALL).flag(YES), command!(group_target, ("remove", ["rem", "rm"]), Optional(MemberRefs) => "group_remove_member") .flag(ALL).flag(YES), - ] - .into_iter(); + ]; let system_groups_cmd = once(command!(group, ("list", ["ls", "l"]), search_param => "groups_self")) diff --git a/crates/command_definitions/src/help.rs b/crates/command_definitions/src/help.rs index 95e73d5c..793934db 100644 --- a/crates/command_definitions/src/help.rs +++ b/crates/command_definitions/src/help.rs @@ -1,6 +1,6 @@ use super::*; -pub fn cmds() -> impl Iterator { +pub fn cmds() -> impl IntoIterator { let help = ("help", ["h"]); [ command!(("commands", ["cmd", "c"]), ("subject", OpaqueString) => "commands_list"), @@ -10,5 +10,4 @@ pub fn cmds() -> impl Iterator { command!(help, "commands" => "help_commands").help("help commands"), command!(help, "proxy" => "help_proxy").help("help proxy"), ] - .into_iter() } diff --git a/crates/command_definitions/src/import_export.rs b/crates/command_definitions/src/import_export.rs index 7e2e9404..bf095263 100644 --- a/crates/command_definitions/src/import_export.rs +++ b/crates/command_definitions/src/import_export.rs @@ -1,9 +1,8 @@ use super::*; -pub fn cmds() -> impl Iterator { +pub fn cmds() -> impl IntoIterator { [ command!("import", Optional(Remainder(("url", OpaqueString))) => "import").flag(YES), command!("export" => "export"), ] - .into_iter() } diff --git a/crates/command_definitions/src/lib.rs b/crates/command_definitions/src/lib.rs index 40617f62..54550b57 100644 --- a/crates/command_definitions/src/lib.rs +++ b/crates/command_definitions/src/lib.rs @@ -25,7 +25,8 @@ use command_parser::{ }; pub fn all() -> impl Iterator { - (help::cmds()) + std::iter::empty() + .chain(help::cmds()) .chain(system::cmds()) .chain(group::cmds()) .chain(member::cmds()) diff --git a/crates/command_definitions/src/member.rs b/crates/command_definitions/src/member.rs index 607cc0a7..e466a26a 100644 --- a/crates/command_definitions/src/member.rs +++ b/crates/command_definitions/src/member.rs @@ -35,16 +35,16 @@ pub fn cmds() -> impl Iterator { let tts = ("tts", ["texttospeech"]); let delete = ("delete", ["del", "remove"]); - let member_new_cmd = [ + let member_new_cmd = once( command!(member, new, ("name", OpaqueString) => "member_new") .help("Creates a new system member"), - ] - .into_iter(); + ); - let member_info_cmd = [command!(member_target => "member_show") - .flag("pt") - .help("Shows information about a member")] - .into_iter(); + let member_info_cmd = once( + command!(member_target => "member_show") + .flag("pt") + .help("Shows information about a member"), + ); let member_name_cmd = { let member_name = tokens!(member_target, name); @@ -54,7 +54,6 @@ pub fn cmds() -> impl Iterator { .flag(YES) .help("Changes a member's name"), ] - .into_iter() }; let member_description_cmd = { @@ -67,7 +66,6 @@ pub fn cmds() -> impl Iterator { command!(member_desc, Remainder(("description", OpaqueString)) => "member_desc_update") .help("Changes a member's description"), ] - .into_iter() }; let member_privacy_cmd = { @@ -81,7 +79,6 @@ pub fn cmds() -> impl Iterator { ) .help("Changes a member's privacy settings"), ] - .into_iter() }; let member_pronouns_cmd = { @@ -94,7 +91,7 @@ pub fn cmds() -> impl Iterator { command!(member_pronouns, CLEAR => "member_pronouns_clear") .flag(YES) .help("Clears a member's pronouns"), - ].into_iter() + ] }; let member_banner_cmd = { @@ -107,7 +104,6 @@ pub fn cmds() -> impl Iterator { .flag(YES) .help("Clears a member's banner image"), ] - .into_iter() }; let member_color_cmd = { @@ -120,7 +116,6 @@ pub fn cmds() -> impl Iterator { .flag(YES) .help("Clears a member's color"), ] - .into_iter() }; let member_birthday_cmd = { @@ -133,7 +128,6 @@ pub fn cmds() -> impl Iterator { .flag(YES) .help("Clears a member's birthday"), ] - .into_iter() }; let member_display_name_cmd = { @@ -146,7 +140,7 @@ pub fn cmds() -> impl Iterator { command!(member_display_name, CLEAR => "member_displayname_clear") .flag(YES) .help("Clears a member's display name"), - ].into_iter() + ] }; let member_server_name_cmd = { @@ -159,7 +153,7 @@ pub fn cmds() -> impl Iterator { command!(member_server_name, CLEAR => "member_servername_clear") .flag(YES) .help("Clears a member's server name"), - ].into_iter() + ] }; let member_proxy_cmd = { @@ -176,7 +170,7 @@ pub fn cmds() -> impl Iterator { .help("Clears all proxy tags from a member"), command!(member_proxy, Remainder(("tags", OpaqueString)) => "member_proxy_set") .help("Sets a member's proxy tags"), - ].into_iter() + ] }; let member_proxy_settings_cmd = { @@ -194,7 +188,7 @@ pub fn cmds() -> impl Iterator { .help("Clears a member's server-specific keep-proxy setting"), command!(member_server_keep_proxy, ("value", Toggle) => "member_server_keepproxy_update") .help("Changes a member's server-specific keep-proxy setting"), - ].into_iter() + ] }; let member_message_settings_cmd = { @@ -210,7 +204,6 @@ pub fn cmds() -> impl Iterator { command!(member_autoproxy, ("value", Toggle) => "member_autoproxy_update") .help("Changes whether a member can be autoproxied"), ] - .into_iter() }; let member_avatar_cmd = { @@ -229,7 +222,6 @@ pub fn cmds() -> impl Iterator { .flag(YES) .help("Clears a member's avatar"), ] - .into_iter() }; let member_webhook_avatar_cmd = { @@ -256,7 +248,6 @@ pub fn cmds() -> impl Iterator { .flag(YES) .help("Clears a member's proxy avatar"), ] - .into_iter() }; let member_server_avatar_cmd = { @@ -289,13 +280,8 @@ pub fn cmds() -> impl Iterator { .flag(YES) .help("Clears a member's server-specific avatar"), ] - .into_iter() }; - let member_avatar_cmds = member_avatar_cmd - .chain(member_webhook_avatar_cmd) - .chain(member_server_avatar_cmd); - let member_group = tokens!(member_target, ("groups", ["group"])); let member_list_group_cmds = once( command!(member_group, Optional(Remainder(("query", OpaqueString))) => "member_groups"), @@ -306,18 +292,16 @@ pub fn cmds() -> impl Iterator { .help("Adds a member to one or more groups"), command!(member_group, ("remove", ["rem"]), Optional(("groups", GroupRefs)) => "member_group_remove") .help("Removes a member from one or more groups"), - ] - .into_iter(); + ]; let member_display_id_cmd = - [command!(member_target, "id" => "member_id").help("Displays a member's ID")].into_iter(); + [command!(member_target, "id" => "member_id").help("Displays a member's ID")]; let member_delete_cmd = - [command!(member_target, delete => "member_delete").help("Deletes a member")].into_iter(); + [command!(member_target, delete => "member_delete").help("Deletes a member")]; let member_easter_eggs = - [command!(member_target, "soulscream" => "member_soulscream").show_in_suggestions(false)] - .into_iter(); + [command!(member_target, "soulscream" => "member_soulscream").show_in_suggestions(false)]; member_new_cmd .chain(member_info_cmd) @@ -331,7 +315,9 @@ pub fn cmds() -> impl Iterator { .chain(member_display_name_cmd) .chain(member_server_name_cmd) .chain(member_proxy_cmd) - .chain(member_avatar_cmds) + .chain(member_avatar_cmd) + .chain(member_webhook_avatar_cmd) + .chain(member_server_avatar_cmd) .chain(member_proxy_settings_cmd) .chain(member_message_settings_cmd) .chain(member_display_id_cmd) diff --git a/crates/command_definitions/src/message.rs b/crates/command_definitions/src/message.rs index 7030ddfb..812b059d 100644 --- a/crates/command_definitions/src/message.rs +++ b/crates/command_definitions/src/message.rs @@ -1,6 +1,6 @@ use super::*; -pub fn cmds() -> impl Iterator { +pub fn cmds() -> impl IntoIterator { let message = tokens!(("message", ["msg", "messageinfo"]), Optional(MessageRef)); let author = ("author", ["sender", "a"]); @@ -31,5 +31,4 @@ pub fn cmds() -> impl Iterator { .flag(author) .help("Shows information about a proxied message"), ] - .into_iter() } diff --git a/crates/command_definitions/src/misc.rs b/crates/command_definitions/src/misc.rs index a87f4d1b..7e7f1641 100644 --- a/crates/command_definitions/src/misc.rs +++ b/crates/command_definitions/src/misc.rs @@ -1,10 +1,9 @@ use super::*; -pub fn cmds() -> impl Iterator { +pub fn cmds() -> impl IntoIterator { [ command!("invite" => "invite").help("Gets a link to invite PluralKit to other servers"), command!(("stats", ["status"]) => "stats") .help("Shows statistics and information about PluralKit"), ] - .into_iter() } diff --git a/crates/command_definitions/src/server_config.rs b/crates/command_definitions/src/server_config.rs index bdceade9..366b1236 100644 --- a/crates/command_definitions/src/server_config.rs +++ b/crates/command_definitions/src/server_config.rs @@ -1,3 +1,5 @@ +use std::iter::once; + use super::*; pub fn cmds() -> impl Iterator { @@ -44,7 +46,6 @@ pub fn cmds() -> impl Iterator { let add = ("add", ["enable", "on", "deny"]); let remove = ("remove", ["disable", "off", "allow"]); - // Log channel commands let log_channel_cmds = [ command!(log_channel => "server_config_log_channel_show") .help("Shows the current log channel"), @@ -53,10 +54,8 @@ pub fn cmds() -> impl Iterator { command!(log_channel, CLEAR => "server_config_log_channel_clear") .flag(YES) .help("Clears the log channel"), - ] - .into_iter(); + ]; - // Log cleanup commands let log_cleanup_cmds = [ command!(log_cleanup => "server_config_log_cleanup_show") .help("Shows whether log cleanup is enabled"), @@ -66,10 +65,8 @@ pub fn cmds() -> impl Iterator { .help("Shows whether log cleanup is enabled"), command!(log_cleanup_short, Toggle => "server_config_log_cleanup_set") .help("Enables or disables log cleanup"), - ] - .into_iter(); + ]; - // Log blacklist commands let log_blacklist_cmds = [ command!(log_blacklist => "server_config_log_blacklist_show") .help("Shows channels where logging is disabled"), @@ -79,10 +76,8 @@ pub fn cmds() -> impl Iterator { command!(log_blacklist, remove, Optional(("channel", ChannelRef)) => "server_config_log_blacklist_remove") .flag(ALL) .help("Removes a channel (or all channels with --all) from the log blacklist"), - ] - .into_iter(); + ]; - // Proxy blacklist commands let proxy_blacklist_cmds = [ command!(proxy_blacklist => "server_config_proxy_blacklist_show") .help("Shows channels where proxying is disabled"), @@ -92,10 +87,8 @@ pub fn cmds() -> impl Iterator { command!(proxy_blacklist, remove, Optional(("channel", ChannelRef)) => "server_config_proxy_blacklist_remove") .flag(ALL) .help("Removes a channel (or all channels with --all) from the proxy blacklist"), - ] - .into_iter(); + ]; - // Invalid command error commands let invalid_cmds = [ command!(invalid => "server_config_invalid_command_response_show") .help("Shows whether error responses for invalid commands are enabled"), @@ -105,10 +98,8 @@ pub fn cmds() -> impl Iterator { .help("Shows whether error responses for invalid commands are enabled"), command!(invalid_short, Toggle => "server_config_invalid_command_response_set") .help("Enables or disables error responses for invalid commands"), - ] - .into_iter(); + ]; - // Require system tag commands let require_tag_cmds = [ command!(require_tag => "server_config_require_system_tag_show") .help("Shows whether system tags are required"), @@ -118,10 +109,8 @@ pub fn cmds() -> impl Iterator { .help("Shows whether system tags are required"), command!(require_tag_short, Toggle => "server_config_require_system_tag_set") .help("Requires or unrequires system tags for proxied messages"), - ] - .into_iter(); + ]; - // Suppress notifications commands let suppress_cmds = [ command!(suppress => "server_config_suppress_notifications_show") .help("Shows whether notifications are suppressed for proxied messages"), @@ -131,13 +120,12 @@ pub fn cmds() -> impl Iterator { .help("Shows whether notifications are suppressed for proxied messages"), command!(suppress_short, Toggle => "server_config_suppress_notifications_set") .help("Enables or disables notification suppression for proxied messages"), - ] - .into_iter(); + ]; - // Main config overview - let main_cmd = [command!(server_config => "server_config_show") - .help("Shows the current server configuration")] - .into_iter(); + let main_cmd = once( + command!(server_config => "server_config_show") + .help("Shows the current server configuration"), + ); main_cmd .chain(log_channel_cmds) diff --git a/crates/command_definitions/src/switch.rs b/crates/command_definitions/src/switch.rs index ef9e15de..c52525ad 100644 --- a/crates/command_definitions/src/switch.rs +++ b/crates/command_definitions/src/switch.rs @@ -1,6 +1,6 @@ use super::*; -pub fn cmds() -> impl Iterator { +pub fn cmds() -> impl IntoIterator { let switch = ("switch", ["sw"]); let edit = ("edit", ["e", "replace"]); @@ -26,5 +26,4 @@ pub fn cmds() -> impl Iterator { command!(switch, copy, Optional(MemberRefs) => "switch_copy").flags(edit_flags), command!(switch, MemberRefs => "switch_do"), ] - .into_iter() } diff --git a/crates/command_definitions/src/system.rs b/crates/command_definitions/src/system.rs index eb8fdf2b..ec25f7db 100644 --- a/crates/command_definitions/src/system.rs +++ b/crates/command_definitions/src/system.rs @@ -20,7 +20,6 @@ pub fn targeted() -> TokensIterator { pub fn edit() -> impl Iterator { let system = system(); - let system_target = targeted(); let system_new_cmd = once( @@ -36,8 +35,7 @@ pub fn edit() -> impl Iterator { .help("Clears your system's webhook URL"), command!(system_webhook, ("url", OpaqueString) => "system_webhook_set") .help("Sets your system's webhook URL"), - ] - .into_iter(); + ]; let add_info_flags = |cmd: Command| { cmd.flag(("public", ["pub"])) @@ -65,8 +63,7 @@ pub fn edit() -> impl Iterator { .help("Clears your system's name"), command!(system_name_self, Remainder(("name", OpaqueString)) => "system_rename") .help("Renames your system"), - ] - .into_iter(); + ]; let server_name = ("servername", ["sn", "guildname"]); let system_server_name_cmd = once( @@ -80,8 +77,7 @@ pub fn edit() -> impl Iterator { .help("Clears your system's server name"), command!(system_server_name_self, Remainder(("name", OpaqueString)) => "system_rename_server_name") .help("Renames your system's server name"), - ] - .into_iter(); + ]; let description = ("description", ["desc", "d"]); let system_description_cmd = once( @@ -95,8 +91,7 @@ pub fn edit() -> impl Iterator { .help("Clears your system's description"), command!(system_description_self, Remainder(("description", OpaqueString)) => "system_change_description") .help("Changes your system's description"), - ] - .into_iter(); + ]; let color = ("color", ["colour"]); let system_color_cmd = once( @@ -110,8 +105,7 @@ pub fn edit() -> impl Iterator { .help("Clears your system's color"), command!(system_color_self, ("color", OpaqueString) => "system_change_color") .help("Changes your system's color"), - ] - .into_iter(); + ]; let tag = ("tag", ["suffix"]); let system_tag_cmd = once( @@ -125,8 +119,7 @@ pub fn edit() -> impl Iterator { .help("Clears your system's tag"), command!(system_tag_self, Remainder(("tag", OpaqueString)) => "system_change_tag") .help("Changes your system's tag"), - ] - .into_iter(); + ]; let servertag = ("servertag", ["st", "guildtag"]); let system_server_tag_cmd = once( @@ -140,8 +133,7 @@ pub fn edit() -> impl Iterator { .help("Clears your system's server tag"), command!(system_server_tag_self, Remainder(("tag", OpaqueString)) => "system_change_server_tag") .help("Changes your system's server tag"), - ] - .into_iter(); + ]; let pronouns = ("pronouns", ["prns"]); let system_pronouns_cmd = once( @@ -155,8 +147,7 @@ pub fn edit() -> impl Iterator { .help("Clears your system's pronouns"), command!(system_pronouns_self, Remainder(("pronouns", OpaqueString)) => "system_change_pronouns") .help("Changes your system's pronouns"), - ] - .into_iter(); + ]; let avatar = ("avatar", ["pfp"]); let system_avatar_cmd = once( @@ -170,11 +161,9 @@ pub fn edit() -> impl Iterator { .help("Clears your system's avatar"), command!(system_avatar_self, ("avatar", Avatar) => "system_change_avatar") .help("Changes your system's avatar"), - ] - .into_iter(); + ]; let serveravatar = ("serveravatar", ["spfp"]); - let system_server_avatar = tokens!(system_target, serveravatar); let system_server_avatar_cmd = once( command!(system, Optional(SystemRef), serveravatar => "system_show_server_avatar") .help("Shows the system's server avatar"), @@ -186,8 +175,7 @@ pub fn edit() -> impl Iterator { .help("Clears your system's server avatar"), command!(system_server_avatar_self, ("avatar", Avatar) => "system_change_server_avatar") .help("Changes your system's server avatar"), - ] - .into_iter(); + ]; let banner = ("banner", ["cover"]); let system_banner_cmd = once( @@ -201,8 +189,7 @@ pub fn edit() -> impl Iterator { .help("Clears your system's banner"), command!(system_banner_self, ("banner", Avatar) => "system_change_banner") .help("Changes your system's banner"), - ] - .into_iter(); + ]; let system_proxy = tokens!(system, "proxy"); let system_proxy_cmd = [ @@ -214,8 +201,7 @@ pub fn edit() -> impl Iterator { .help("Shows your system's proxy setting for a guild"), command!(system_proxy, GuildRef, Toggle => "system_toggle_proxy") .help("Toggle your system's proxy for a guild"), - ] - .into_iter(); + ]; let system_privacy = tokens!(system, ("privacy", ["priv"])); let system_privacy_cmd = [ @@ -225,7 +211,7 @@ pub fn edit() -> impl Iterator { .help("Changes all privacy settings for your system"), command!(system_privacy, ("privacy", SystemPrivacyTarget), ("level", PrivacyLevel) => "system_change_privacy") .help("Changes a specific privacy setting for your system"), - ].into_iter(); + ]; let front = ("front", ["fronter", "fronters", "f"]); let make_front_history = |subcmd: TokensIterator| { @@ -243,8 +229,7 @@ pub fn edit() -> impl Iterator { make_front_history(tokens!(("fronthistory", ["fh"]))), make_front_percent(tokens!(front, ("percent", ["p", "%"]))), make_front_percent(tokens!(("frontpercent", ["fp"]))), - ] - .into_iter(); + ]; let search_param = Optional(Remainder(("query", OpaqueString))); let apply_list_opts = |cmd: Command| cmd.flags(get_list_flags()); @@ -270,8 +255,7 @@ pub fn edit() -> impl Iterator { let system_link = [ command!("link", ("account", UserRef) => "system_link"), command!("unlink", ("account", OpaqueString) => "system_unlink").flag(YES), - ] - .into_iter(); + ]; system_new_cmd .chain(system_webhook_cmd) diff --git a/crates/command_parser/src/tree.rs b/crates/command_parser/src/tree.rs index ac5420e2..42939a3b 100644 --- a/crates/command_parser/src/tree.rs +++ b/crates/command_parser/src/tree.rs @@ -1,6 +1,6 @@ use ordermap::OrderMap; -use crate::{command::Command, parameter::Skip, token::Token}; +use crate::{command::Command, token::Token}; #[derive(Debug, Clone)] pub struct TreeBranch {