diff --git a/src/builtins/register.rs b/src/builtins/register.rs index 8caa9a2f2b1..0c9b2312246 100644 --- a/src/builtins/register.rs +++ b/src/builtins/register.rs @@ -16,8 +16,8 @@ use crate::serenity_prelude as serenity; /// serenity::Command::set_global_commands(ctx, create_commands).await?; /// # Ok(()) } /// ``` -pub fn create_application_commands( - commands: &[crate::Command], +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 @@ -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);