Skip to content

Commit

Permalink
Ensure JSON output is consistently ordered
Browse files Browse the repository at this point in the history
Closes #780
  • Loading branch information
Wilfred committed Nov 16, 2024
1 parent 3a1e398 commit 00f6959
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/display/json.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::collections::HashMap;
use std::collections::BTreeMap;

use line_numbers::LineNumber;
use serde::{ser::SerializeStruct, Serialize, Serializer};
Expand Down Expand Up @@ -112,7 +112,7 @@ impl<'f> From<&'f DiffResult> for File<'f> {

let mut chunks = Vec::with_capacity(hunks.len());
for hunk in &hunks {
let mut lines = HashMap::with_capacity(hunk.lines.len());
let mut lines = BTreeMap::new();

let (start_i, end_i) = matched_lines_indexes_for_hunk(matched_lines, hunk, 0);
let aligned_lines = &matched_lines[start_i..end_i];
Expand Down

0 comments on commit 00f6959

Please sign in to comment.