Skip to content

Commit

Permalink
Reduce allocation in subs.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
WGUNDERWOOD committed Sep 3, 2024
1 parent 4e217c7 commit 4d4da10
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/subs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,11 @@ pub fn environments_new_line(
let comment = &get_comment(line, comment_index);
let text = &remove_comment(line, comment_index);
let text = &RE_ENV_BEGIN_SHARED_LINE
.replace_all(text, format!("$prev{LINE_END}$env"))
.to_string();
.replace_all(text, format!("$prev{LINE_END}$env"));
let text = &RE_ENV_END_SHARED_LINE
.replace_all(text, format!("$prev{LINE_END}$env"))
.to_string();
.replace_all(text, format!("$prev{LINE_END}$env"));
let text = &RE_ITEM_SHARED_LINE
.replace_all(text, format!("$prev{LINE_END}$env"))
.to_string();
.replace_all(text, format!("$prev{LINE_END}$env"));
new_text.push_str(text);
new_text.push_str(comment);
} else {
Expand Down

0 comments on commit 4d4da10

Please sign in to comment.