From 7e84797900f1b6f61e16d8a4766b8209673a7acb Mon Sep 17 00:00:00 2001 From: orhun Date: Sat, 14 Aug 2021 15:56:53 +0300 Subject: [PATCH] perf(changelog): optimize the release vector size --- git-cliff/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-cliff/src/lib.rs b/git-cliff/src/lib.rs index a8455d3718..a0fbe111bd 100644 --- a/git-cliff/src/lib.rs +++ b/git-cliff/src/lib.rs @@ -114,7 +114,7 @@ pub fn run(mut args: Opt) -> Result<()> { } // Process releases. - let mut releases = vec![Release::default(); tags.len() + 1]; + let mut releases = vec![Release::default()]; let mut release_index = 0; let mut previous_release = Release::default(); for git_commit in commits.into_iter().rev() { @@ -128,6 +128,7 @@ pub fn run(mut args: Opt) -> Result<()> { previous_release.previous = None; releases[release_index].previous = Some(Box::new(previous_release)); previous_release = releases[release_index].clone(); + releases.push(Release::default()); release_index += 1; } }