Skip to content

Commit 62efcee

Browse files
committed
remove try_trait feature
1 parent 3afd141 commit 62efcee

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
//! As these implementations are often in hot code paths, unsafe is used, albeit only when necessary to a) achieve the asymptotically optimal algorithm or b) mitigate an observed bottleneck.
2323
2424
#![doc(html_root_url = "https://docs.rs/streaming_algorithms/0.1.1")]
25-
#![feature(specialization, try_trait)]
25+
#![feature(specialization)]
2626
#![warn(
2727
missing_copy_implementations,
2828
missing_debug_implementations,

src/top.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -185,25 +185,6 @@ impl<T> From<Option<T>> for Zeroable<T> {
185185
}
186186
}
187187
}
188-
impl<T> std::ops::Try for Zeroable<T> {
189-
type Ok = T;
190-
type Error = std::option::NoneError;
191-
192-
#[inline]
193-
fn into_result(self) -> Result<T, std::option::NoneError> {
194-
self.ok_or(std::option::NoneError)
195-
}
196-
197-
#[inline]
198-
fn from_ok(v: T) -> Self {
199-
Zeroable::Nonzero(v)
200-
}
201-
202-
#[inline]
203-
fn from_error(_: std::option::NoneError) -> Self {
204-
Zeroable::Zero
205-
}
206-
}
207188
impl<T> iter::Sum for Zeroable<T>
208189
where
209190
Self: iter::Sum<T>,
@@ -232,7 +213,11 @@ impl<
232213
where
233214
I: Iterator<Item = Top<A, C>>,
234215
{
235-
let mut total = iter.next()?;
216+
let mut total = if let Some(total) = iter.next() {
217+
total
218+
} else {
219+
return Zeroable::Zero;
220+
};
236221
for sample in iter {
237222
total += sample;
238223
}

0 commit comments

Comments
 (0)