Use &Snapshot directly instead of impl Into<Content<'a>>

The text::Buffer and its snapshot already used the same representation
for their content, so we can just make Buffer deref to a Snapshot.
This commit is contained in:
Max Brunsfeld
2021-11-30 13:32:11 -08:00
parent 36546463e6
commit 924e1578ea
10 changed files with 197 additions and 436 deletions
+5 -3
View File
@@ -359,7 +359,8 @@ impl FoldMap {
}
if fold.start > sum.input.bytes {
let text_summary = buffer.text_summary_for_range(sum.input.bytes..fold.start);
let text_summary = buffer
.text_summary_for_range::<TextSummary, _>(sum.input.bytes..fold.start);
new_transforms.push(
Transform {
summary: TransformSummary {
@@ -400,7 +401,8 @@ impl FoldMap {
let sum = new_transforms.summary();
if sum.input.bytes < edit.new.end {
let text_summary = buffer.text_summary_for_range(sum.input.bytes..edit.new.end);
let text_summary =
buffer.text_summary_for_range::<TextSummary, _>(sum.input.bytes..edit.new.end);
new_transforms.push(
Transform {
summary: TransformSummary {
@@ -539,7 +541,7 @@ impl Snapshot {
let buffer_end = cursor.start().1 + end_in_transform;
summary += self
.buffer_snapshot
.text_summary_for_range(buffer_start..buffer_end);
.text_summary_for_range::<TextSummary, _>(buffer_start..buffer_end);
}
}
}