editor: Shrink DisplayMapSnapshot from 824 to 256 bytes (#39568)

We have unnecessary clones for the fields here as most of the snapshots
contain the others hierarchically.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth
2025-10-06 08:08:49 +00:00
committed by GitHub
parent 9c7369f54d
commit 2bfcd60b88
48 changed files with 594 additions and 543 deletions
@@ -504,7 +504,7 @@ impl EditorTestContext {
.map(|h| h.1.clone())
.unwrap_or_default()
.iter()
.map(|range| range.to_offset(&snapshot.buffer_snapshot))
.map(|range| range.to_offset(&snapshot.buffer_snapshot()))
.collect()
});
assert_set_eq!(actual_ranges, expected_ranges);
@@ -519,7 +519,7 @@ impl EditorTestContext {
.map(|ranges| ranges.as_ref().clone().1)
.unwrap_or_default()
.into_iter()
.map(|range| range.to_offset(&snapshot.buffer_snapshot))
.map(|range| range.to_offset(&snapshot.buffer_snapshot()))
.collect();
assert_set_eq!(actual_ranges, expected_ranges);
}
@@ -579,7 +579,7 @@ pub fn assert_state_with_diff(
) {
let (snapshot, selections) = editor.update_in(cx, |editor, window, cx| {
(
editor.snapshot(window, cx).buffer_snapshot.clone(),
editor.snapshot(window, cx).buffer_snapshot().clone(),
editor.selections.ranges::<usize>(cx),
)
});