Warnings
This commit is contained in:
parent
4e2907e296
commit
2be18a200f
1 changed files with 2 additions and 14 deletions
|
@ -40,7 +40,7 @@ pub trait Summary: Clone {
|
||||||
|
|
||||||
fn zero(cx: &Self::Context) -> Self;
|
fn zero(cx: &Self::Context) -> Self;
|
||||||
fn add_summary(&mut self, summary: &Self, cx: &Self::Context);
|
fn add_summary(&mut self, summary: &Self, cx: &Self::Context);
|
||||||
fn sub_summary(&mut self, summary: &Self, cx: &Self::Context) {}
|
fn sub_summary(&mut self, _: &Self, _: &Self::Context) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Catch-all implementation for when you need something that implements [`Summary`] without a specific type.
|
/// Catch-all implementation for when you need something that implements [`Summary`] without a specific type.
|
||||||
|
@ -297,7 +297,7 @@ impl<T: Item> SumTree<T> {
|
||||||
} else {
|
} else {
|
||||||
summary
|
summary
|
||||||
};
|
};
|
||||||
previous_item.insert(current_item.clone());
|
_ = previous_item.insert(current_item.clone());
|
||||||
Some(current_item)
|
Some(current_item)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
@ -923,18 +923,6 @@ impl<T: KeyedItem> Edit<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sum<'a, T, I>(iter: I, cx: &T::Context) -> T
|
|
||||||
where
|
|
||||||
T: 'a + Summary,
|
|
||||||
I: Iterator<Item = &'a T>,
|
|
||||||
{
|
|
||||||
let mut sum = T::zero(cx);
|
|
||||||
for value in iter {
|
|
||||||
sum.add_summary(value, cx);
|
|
||||||
}
|
|
||||||
sum
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue