Skip to content

Commit

Permalink
Restore with_capacity optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
zkxs committed Aug 12, 2024
1 parent bb3758b commit b9edb99
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/builtins/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ pub fn create_application_commands<'a, U: 'a, E: 'a>(
}
}

let mut commands_builder = Vec::new();
for command in commands {
let command_iter = commands.into_iter();
let mut commands_builder = Vec::with_capacity(command_iter.size_hint().0);
for command in command_iter {
if let Some(slash_command) = command.create_as_slash_command() {
commands_builder.push(slash_command);
}
Expand Down

0 comments on commit b9edb99

Please sign in to comment.