Skip to content

Commit 6157568

Browse files
Rawkytmimi
authored andcommitted
Preallocate missmatches in JsonEmitter::add_misformatted_file
The mismatches length is known to be equal to `diff.len()`.
1 parent 0339b96 commit 6157568

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/emitter/json.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl JsonEmitter {
5757
filename: &FileName,
5858
diff: Vec<Mismatch>,
5959
) -> Result<(), io::Error> {
60-
let mut mismatches = vec![];
60+
let mut mismatches = Vec::with_capacity(diff.len());
6161
for mismatch in diff {
6262
let original_begin_line = mismatch.line_number_orig;
6363
let expected_begin_line = mismatch.line_number;

0 commit comments

Comments
 (0)