Remove add_summary_with_ctx and always require a ctx in add_summary

This commit is contained in:
Antonio Scandurra
2021-05-06 16:57:47 +02:00
parent 901525bf77
commit 652fc9e4ec
7 changed files with 23 additions and 23 deletions
+2 -2
View File
@@ -2105,7 +2105,7 @@ impl sum_tree::Item for Fragment {
impl sum_tree::Summary for FragmentSummary {
type Context = ();
fn add_summary(&mut self, other: &Self) {
fn add_summary(&mut self, other: &Self, _: Option<&Self::Context>) {
self.text_summary += &other.text_summary;
debug_assert!(self.max_fragment_id <= other.max_fragment_id);
self.max_fragment_id = other.max_fragment_id.clone();
@@ -2171,7 +2171,7 @@ impl sum_tree::Item for InsertionSplit {
impl sum_tree::Summary for InsertionSplitSummary {
type Context = ();
fn add_summary(&mut self, other: &Self) {
fn add_summary(&mut self, other: &Self, _: Option<&Self::Context>) {
self.extent += other.extent;
}
}
+1 -1
View File
@@ -61,7 +61,7 @@ pub struct TextSummary {
impl sum_tree::Summary for TextSummary {
type Context = ();
fn add_summary(&mut self, other: &Self) {
fn add_summary(&mut self, other: &Self, _: Option<&Self::Context>) {
*self += other;
}
}
+3 -3
View File
@@ -459,7 +459,7 @@ impl sum_tree::Item for Transform {
impl sum_tree::Summary for TransformSummary {
type Context = ();
fn add_summary(&mut self, other: &Self) {
fn add_summary(&mut self, other: &Self, _: Option<&Self::Context>) {
self.buffer += &other.buffer;
self.display += &other.display;
}
@@ -467,7 +467,7 @@ impl sum_tree::Summary for TransformSummary {
impl<'a> sum_tree::Dimension<'a, TransformSummary> for TransformSummary {
fn add_summary(&mut self, summary: &'a TransformSummary) {
sum_tree::Summary::add_summary(self, summary);
sum_tree::Summary::add_summary(self, summary, None);
}
}
@@ -512,7 +512,7 @@ impl Default for FoldSummary {
impl sum_tree::Summary for FoldSummary {
type Context = Buffer;
fn add_summary_with_ctx(&mut self, other: &Self, buffer: Option<&Self::Context>) {
fn add_summary(&mut self, other: &Self, buffer: Option<&Self::Context>) {
let buffer = buffer.unwrap();
if other.min_start.cmp(&self.min_start, buffer).unwrap() == Ordering::Less {
self.min_start = other.min_start.clone();