mirror of
https://github.com/orhun/git-cliff.git
synced 2024-11-29 04:07:32 +03:00
perf(test): don't create regex inside a loop (#937)
This commit is contained in:
parent
a9b26901e3
commit
0fabf22c52
@ -266,6 +266,11 @@ fn generate_changelog() -> Result<()> {
|
||||
let template = Template::new("test", changelog_config.body.unwrap(), false)?;
|
||||
|
||||
writeln!(out, "{}", changelog_config.header.unwrap()).unwrap();
|
||||
let text_processors = [TextProcessor {
|
||||
pattern: Regex::new("<DATE>").unwrap(),
|
||||
replace: Some(String::from("2023")),
|
||||
replace_command: None,
|
||||
}];
|
||||
for release in releases {
|
||||
write!(
|
||||
out,
|
||||
@ -273,11 +278,7 @@ fn generate_changelog() -> Result<()> {
|
||||
template.render(
|
||||
&release,
|
||||
Option::<HashMap<&str, String>>::None.as_ref(),
|
||||
&[TextProcessor {
|
||||
pattern: Regex::new("<DATE>").unwrap(),
|
||||
replace: Some(String::from("2023")),
|
||||
replace_command: None,
|
||||
}]
|
||||
&text_processors
|
||||
)?
|
||||
)
|
||||
.unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user