Skip to content

Commit

Permalink
Preallocate string for performance
Browse files Browse the repository at this point in the history
  • Loading branch information
WGUNDERWOOD committed May 15, 2024
1 parent 6cc8e45 commit 23e3d45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/indent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fn get_indent(line: &str, prev_indent: Indent) -> Indent {
pub fn apply_indent(file: &str, args: &Cli) -> (String, Vec<(usize, Indent)>) {
log::info!("Indenting file");
let mut indent = Indent::new();
let mut new_file = "".to_owned();
let mut new_file = String::with_capacity(file.len());
let mut verbatim_count = 0;
let mut indent_errs = vec![];

Expand Down

0 comments on commit 23e3d45

Please sign in to comment.