summaryrefslogtreecommitdiffstats
path: root/vendor/itertools/src/adaptors
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/itertools/src/adaptors')
-rw-r--r--vendor/itertools/src/adaptors/coalesce.rs4
-rw-r--r--vendor/itertools/src/adaptors/mod.rs14
-rw-r--r--vendor/itertools/src/adaptors/multi_product.rs4
3 files changed, 6 insertions, 16 deletions
diff --git a/vendor/itertools/src/adaptors/coalesce.rs b/vendor/itertools/src/adaptors/coalesce.rs
index b1aff6e27..3df7cc582 100644
--- a/vendor/itertools/src/adaptors/coalesce.rs
+++ b/vendor/itertools/src/adaptors/coalesce.rs
@@ -3,6 +3,7 @@ use std::iter::FusedIterator;
use crate::size_hint;
+#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub struct CoalesceBy<I, F, T>
where
I: Iterator,
@@ -86,7 +87,6 @@ impl<I: Iterator, F: CoalescePredicate<I::Item, T>, T> FusedIterator for Coalesc
/// An iterator adaptor that may join together adjacent elements.
///
/// See [`.coalesce()`](crate::Itertools::coalesce) for more information.
-#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub type Coalesce<I, F> = CoalesceBy<I, F, <I as Iterator>::Item>;
impl<F, Item, T> CoalescePredicate<Item, T> for F
@@ -113,7 +113,6 @@ where
/// An iterator adaptor that removes repeated duplicates, determining equality using a comparison function.
///
/// See [`.dedup_by()`](crate::Itertools::dedup_by) or [`.dedup()`](crate::Itertools::dedup) for more information.
-#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub type DedupBy<I, Pred> = CoalesceBy<I, DedupPred2CoalescePred<Pred>, <I as Iterator>::Item>;
#[derive(Clone)]
@@ -186,7 +185,6 @@ where
///
/// See [`.dedup_by_with_count()`](crate::Itertools::dedup_by_with_count) or
/// [`.dedup_with_count()`](crate::Itertools::dedup_with_count) for more information.
-#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub type DedupByWithCount<I, Pred> =
CoalesceBy<I, DedupPredWithCount2CoalescePred<Pred>, (usize, <I as Iterator>::Item)>;
diff --git a/vendor/itertools/src/adaptors/mod.rs b/vendor/itertools/src/adaptors/mod.rs
index 2010f535b..1695bbd65 100644
--- a/vendor/itertools/src/adaptors/mod.rs
+++ b/vendor/itertools/src/adaptors/mod.rs
@@ -35,9 +35,7 @@ pub struct Interleave<I, J> {
/// Create an iterator that interleaves elements in `i` and `j`.
///
-/// [`IntoIterator`] enabled version of `i.interleave(j)`.
-///
-/// See [`.interleave()`](crate::Itertools::interleave) for more information.
+/// [`IntoIterator`] enabled version of `[Itertools::interleave]`.
pub fn interleave<I, J>(i: I, j: J) -> Interleave<<I as IntoIterator>::IntoIter, <J as IntoIterator>::IntoIter>
where I: IntoIterator,
J: IntoIterator<Item = I::Item>
@@ -210,7 +208,7 @@ impl<I> PutBack<I>
/// If a value is already in the put back slot, it is overwritten.
#[inline]
pub fn put_back(&mut self, x: I::Item) {
- self.top = Some(x)
+ self.top = Some(x);
}
}
@@ -329,12 +327,7 @@ impl<I, J> Iterator for Product<I, J>
}
Some(x) => x
};
- match self.a_cur {
- None => None,
- Some(ref a) => {
- Some((a.clone(), elt_b))
- }
- }
+ self.a_cur.as_ref().map(|a| (a.clone(), elt_b))
}
fn size_hint(&self) -> (usize, Option<usize>) {
@@ -492,7 +485,6 @@ impl<T: PartialOrd> MergePredicate<T> for MergeLte {
/// Iterator element type is `I::Item`.
///
/// See [`.merge()`](crate::Itertools::merge_by) for more information.
-#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub type Merge<I, J> = MergeBy<I, J, MergeLte>;
/// Create an iterator that merges elements in `i` and `j`.
diff --git a/vendor/itertools/src/adaptors/multi_product.rs b/vendor/itertools/src/adaptors/multi_product.rs
index 30650eda6..0b3840698 100644
--- a/vendor/itertools/src/adaptors/multi_product.rs
+++ b/vendor/itertools/src/adaptors/multi_product.rs
@@ -40,7 +40,7 @@ pub fn multi_cartesian_product<H>(iters: H) -> MultiProduct<<H::Item as IntoIter
}
#[derive(Clone, Debug)]
-/// Holds the state of a single iterator within a MultiProduct.
+/// Holds the state of a single iterator within a `MultiProduct`.
struct MultiProductIter<I>
where I: Iterator + Clone,
I::Item: Clone
@@ -50,7 +50,7 @@ struct MultiProductIter<I>
iter_orig: I,
}
-/// Holds the current state during an iteration of a MultiProduct.
+/// Holds the current state during an iteration of a `MultiProduct`.
#[derive(Debug)]
enum MultiProductIterState {
StartOfIter,