Skip to content

Commit

Permalink
Preallocate missmatches in JsonEmitter::add_misformatted_file
Browse files Browse the repository at this point in the history
The mismatches length is known to be equal to `diff.len()`.
  • Loading branch information
Rawk authored and ytmimi committed Sep 20, 2024
1 parent 0339b96 commit 6157568
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/emitter/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl JsonEmitter {
filename: &FileName,
diff: Vec<Mismatch>,
) -> Result<(), io::Error> {
let mut mismatches = vec![];
let mut mismatches = Vec::with_capacity(diff.len());
for mismatch in diff {
let original_begin_line = mismatch.line_number_orig;
let expected_begin_line = mismatch.line_number;
Expand Down

0 comments on commit 6157568

Please sign in to comment.