Auto merge of #38713 - clarcharr:trusted_len, r=brson

TrustedLen for Empty and Once.

These implementations were missing, so, I went ahead and added them.
This commit is contained in:
bors 2017-01-01 05:39:16 +00:00
commit 453172bdf9

View File

@ -12,7 +12,7 @@ use fmt;
use marker;
use usize;
use super::FusedIterator;
use super::{FusedIterator, TrustedLen};
/// An iterator that repeats an element endlessly.
///
@ -138,6 +138,9 @@ impl<T> ExactSizeIterator for Empty<T> {
}
}
#[unstable(feature = "trusted_len", issue = "37572")]
unsafe impl<T> TrustedLen for Empty<T> {}
#[unstable(feature = "fused", issue = "35602")]
impl<T> FusedIterator for Empty<T> {}
@ -216,6 +219,9 @@ impl<T> ExactSizeIterator for Once<T> {
}
}
#[unstable(feature = "trusted_len", issue = "37572")]
unsafe impl<T> TrustedLen for Once<T> {}
#[unstable(feature = "fused", issue = "35602")]
impl<T> FusedIterator for Once<T> {}