diff --git a/src/builtins/register.rs b/src/builtins/register.rs index 1c55890b434..12832bfc5ac 100644 --- a/src/builtins/register.rs +++ b/src/builtins/register.rs @@ -16,9 +16,9 @@ use crate::serenity_prelude as serenity; /// serenity::Command::set_global_commands(ctx.http(), &create_commands).await?; /// # Ok(()) } /// ``` -pub fn create_application_commands( - commands: &[crate::Command], -) -> Vec> { +pub fn create_application_commands<'a, U:'a , E: 'a>( + commands: impl IntoIterator>, +) -> Vec { /// We decided to extract context menu commands recursively, despite the subcommand hierarchy /// not being preserved. Because it's more confusing to just silently discard context menu /// commands if they're not top-level commands. @@ -35,7 +35,7 @@ pub fn create_application_commands( } } - let mut commands_builder = Vec::with_capacity(commands.len()); + let mut commands_builder = Vec::new(); for command in commands { if let Some(slash_command) = command.create_as_slash_command() { commands_builder.push(slash_command);