@@ -384,29 +384,29 @@ macro_rules! izip {
384
384
///
385
385
/// Empty invocations of `chain!` expand to an invocation of [`std::iter::empty`]:
386
386
/// ```
387
- /// use std::iter;
388
387
/// use itertools::chain;
388
+ /// use std::iter;
389
389
///
390
390
/// let _: iter::Empty<()> = chain!();
391
391
/// let _: iter::Empty<i8> = chain!();
392
392
/// ```
393
393
///
394
394
/// Invocations of `chain!` with one argument expand to [`arg.into_iter()`](IntoIterator):
395
395
/// ```
396
- /// use std::ops::Range;
397
396
/// use itertools::chain;
397
+ /// use std::ops::Range;
398
398
/// let _: <Range<_> as IntoIterator>::IntoIter = chain!(2..6,); // trailing comma optional!
399
399
/// let _: <&[_] as IntoIterator>::IntoIter = chain!(&[2, 3, 4]);
400
400
/// ```
401
401
///
402
402
/// Invocations of `chain!` with multiple arguments [`.into_iter()`](IntoIterator) each
403
403
/// argument, and then [`chain`] them together:
404
404
/// ```
405
- /// use std::{iter::*, slice};
406
405
/// use itertools::{assert_equal, chain};
406
+ /// use std::{iter::*, slice};
407
407
///
408
408
/// // e.g., this:
409
- /// let with_macro: Chain<Chain<Once<_>, Take<Repeat<_>>>, slice::Iter<_>> =
409
+ /// let with_macro: Chain<Chain<Once<_>, Take<Repeat<_>>>, slice::Iter<_>> =
410
410
/// chain![once(&0), repeat(&1).take(2), &[2, 3, 5],];
411
411
///
412
412
/// // ...is equivalent to this:
@@ -653,7 +653,6 @@ pub trait Itertools: Iterator {
653
653
///
654
654
/// itertools::assert_equal(pit, vec![(0, 1), (2, 3)]);
655
655
/// ```
656
- ///
657
656
fn batching < B , F > ( self , f : F ) -> Batching < Self , F >
658
657
where
659
658
F : FnMut ( & mut Self ) -> Option < B > ,
@@ -1100,8 +1099,8 @@ pub trait Itertools: Iterator {
1100
1099
/// and remove both `i` and `j` from their respective source iterators
1101
1100
///
1102
1101
/// ```
1102
+ /// use itertools::EitherOrBoth::{Both, Left, Right};
1103
1103
/// use itertools::Itertools;
1104
- /// use itertools::EitherOrBoth::{Left, Right, Both};
1105
1104
///
1106
1105
/// let a = vec![0, 2, 4, 6, 1].into_iter();
1107
1106
/// let b = (0..10).step_by(3);
@@ -1129,8 +1128,8 @@ pub trait Itertools: Iterator {
1129
1128
/// "less" than the second argument.
1130
1129
///
1131
1130
/// ```
1132
- /// use itertools::Itertools;
1133
1131
/// use itertools::Either::{Left, Right};
1132
+ /// use itertools::Itertools;
1134
1133
///
1135
1134
/// let a = vec![0, 2, 4, 6, 1].into_iter();
1136
1135
/// let b = (0..10).step_by(3);
@@ -1543,7 +1542,6 @@ pub trait Itertools: Iterator {
1543
1542
/// .collect::<String>();
1544
1543
/// assert_eq!(decimals, "0123456789");
1545
1544
/// assert_eq!(hexadecimals.next(), Some('a'));
1546
- ///
1547
1545
/// ```
1548
1546
fn take_while_ref < F > ( & mut self , accept : F ) -> TakeWhileRef < Self , F >
1549
1547
where
@@ -1633,8 +1631,8 @@ pub trait Itertools: Iterator {
1633
1631
/// // List all hexadecimal digits
1634
1632
/// itertools::assert_equal(
1635
1633
/// (0..).map(|i| std::char::from_digit(i, 16)).while_some(),
1636
- /// "0123456789abcdef".chars());
1637
- ///
1634
+ /// "0123456789abcdef".chars(),
1635
+ /// );
1638
1636
/// ```
1639
1637
fn while_some < A > ( self ) -> WhileSome < Self >
1640
1638
where
@@ -1930,13 +1928,13 @@ pub trait Itertools: Iterator {
1930
1928
/// ```
1931
1929
/// use itertools::Itertools;
1932
1930
///
1933
- /// let it = (0..5).pad_using(10, |i| 2* i);
1931
+ /// let it = (0..5).pad_using(10, |i| 2 * i);
1934
1932
/// itertools::assert_equal(it, vec![0, 1, 2, 3, 4, 10, 12, 14, 16, 18]);
1935
1933
///
1936
- /// let it = (0..10).pad_using(5, |i| 2* i);
1934
+ /// let it = (0..10).pad_using(5, |i| 2 * i);
1937
1935
/// itertools::assert_equal(it, vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
1938
1936
///
1939
- /// let it = (0..5).pad_using(10, |i| 2* i).rev();
1937
+ /// let it = (0..5).pad_using(10, |i| 2 * i).rev();
1940
1938
/// itertools::assert_equal(it, vec![18, 16, 14, 12, 10, 4, 3, 2, 1, 0]);
1941
1939
/// ```
1942
1940
fn pad_using < F > ( self , min : usize , f : F ) -> PadUsing < Self , F >
@@ -2243,7 +2241,7 @@ pub trait Itertools: Iterator {
2243
2241
/// assert!(data[3..5].iter().all_equal());
2244
2242
/// assert!(data[5..8].iter().all_equal());
2245
2243
///
2246
- /// let data : Option<usize> = None;
2244
+ /// let data: Option<usize> = None;
2247
2245
/// assert!(data.into_iter().all_equal());
2248
2246
/// ```
2249
2247
fn all_equal ( & mut self ) -> bool
@@ -2271,7 +2269,7 @@ pub trait Itertools: Iterator {
2271
2269
/// assert_eq!(data[3..5].iter().all_equal_value(), Ok(&2));
2272
2270
/// assert_eq!(data[5..8].iter().all_equal_value(), Ok(&3));
2273
2271
///
2274
- /// let data : Option<usize> = None;
2272
+ /// let data: Option<usize> = None;
2275
2273
/// assert_eq!(data.into_iter().all_equal_value(), Err(None));
2276
2274
/// ```
2277
2275
#[ allow( clippy:: type_complexity) ]
@@ -2301,7 +2299,7 @@ pub trait Itertools: Iterator {
2301
2299
/// assert!(data[0..4].iter().all_unique());
2302
2300
/// assert!(data[1..6].iter().all_unique());
2303
2301
///
2304
- /// let data : Option<usize> = None;
2302
+ /// let data: Option<usize> = None;
2305
2303
/// assert!(data.into_iter().all_unique());
2306
2304
/// ```
2307
2305
#[ cfg( feature = "use_std" ) ]
@@ -2403,8 +2401,8 @@ pub trait Itertools: Iterator {
2403
2401
/// # Example
2404
2402
///
2405
2403
/// ```
2406
- /// use std::{fs, io};
2407
2404
/// use itertools::Itertools;
2405
+ /// use std::{fs, io};
2408
2406
///
2409
2407
/// fn process_dir_entries(entries: &[fs::DirEntry]) {
2410
2408
/// // ...
@@ -2576,8 +2574,8 @@ pub trait Itertools: Iterator {
2576
2574
/// this effectively results in *((0 + 1) + 2) + 3*
2577
2575
///
2578
2576
/// ```
2579
- /// use std::ops::Add;
2580
2577
/// use itertools::Itertools;
2578
+ /// use std::ops::Add;
2581
2579
///
2582
2580
/// let values = [1, 2, -2, -1, 2, 1];
2583
2581
/// assert_eq!(
@@ -2616,8 +2614,8 @@ pub trait Itertools: Iterator {
2616
2614
/// This is the `Option` equivalent to [`fold_ok`](Itertools::fold_ok).
2617
2615
///
2618
2616
/// ```
2619
- /// use std::ops::Add;
2620
2617
/// use itertools::Itertools;
2618
+ /// use std::ops::Add;
2621
2619
///
2622
2620
/// let mut values = vec![Some(1), Some(2), Some(-2)].into_iter();
2623
2621
/// assert_eq!(values.fold_options(5, Add::add), Some(5 + 1 + 2 - 2));
@@ -2832,8 +2830,8 @@ pub trait Itertools: Iterator {
2832
2830
/// early exit via short-circuiting.
2833
2831
///
2834
2832
/// ```
2835
- /// use itertools::Itertools;
2836
2833
/// use itertools::FoldWhile::{Continue, Done};
2834
+ /// use itertools::Itertools;
2837
2835
///
2838
2836
/// let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
2839
2837
///
@@ -3662,7 +3660,7 @@ pub trait Itertools: Iterator {
3662
3660
/// have a distinct type.
3663
3661
///
3664
3662
/// ```
3665
- /// use itertools::{Itertools, Either };
3663
+ /// use itertools::{Either, Itertools };
3666
3664
///
3667
3665
/// let successes_and_failures = vec![Ok(1), Err(false), Err(true), Ok(2)];
3668
3666
///
@@ -3761,17 +3759,17 @@ pub trait Itertools: Iterator {
3761
3759
/// let lookup: HashMap<u32,Vec<(u32, u32)>> =
3762
3760
/// data.clone().into_iter().into_group_map_by(|a| a.0);
3763
3761
///
3764
- /// assert_eq!(lookup[&0], vec![(0,10), (0,20)]);
3762
+ /// assert_eq!(lookup[&0], vec![(0, 10), (0, 20)]);
3765
3763
/// assert_eq!(lookup.get(&1), None);
3766
- /// assert_eq!(lookup[&2], vec![(2,12), (2,42)]);
3767
- /// assert_eq!(lookup[&3], vec![(3,13), (3,33)]);
3764
+ /// assert_eq!(lookup[&2], vec![(2, 12), (2, 42)]);
3765
+ /// assert_eq!(lookup[&3], vec![(3, 13), (3, 33)]);
3768
3766
///
3769
3767
/// assert_eq!(
3770
3768
/// data.into_iter()
3771
3769
/// .into_group_map_by(|x| x.0)
3772
3770
/// .into_iter()
3773
- /// .map(|(key, values)| (key, values.into_iter().fold(0,|acc, (_,v)| acc + v )))
3774
- /// .collect::<HashMap<u32,u32>>()[&0],
3771
+ /// .map(|(key, values)| (key, values.into_iter().fold(0, |acc, (_, v)| acc + v)))
3772
+ /// .collect::<HashMap<u32, u32>>()[&0],
3775
3773
/// 30,
3776
3774
/// );
3777
3775
/// ```
@@ -4033,7 +4031,7 @@ pub trait Itertools: Iterator {
4033
4031
///
4034
4032
/// ```
4035
4033
/// use itertools::Itertools;
4036
- /// use itertools::MinMaxResult::{NoElements, OneElement, MinMax };
4034
+ /// use itertools::MinMaxResult::{MinMax, NoElements, OneElement };
4037
4035
///
4038
4036
/// let a: [i32; 0] = [];
4039
4037
/// assert_eq!(a.iter().minmax(), NoElements);
@@ -4302,7 +4300,7 @@ pub trait Itertools: Iterator {
4302
4300
///
4303
4301
/// ```
4304
4302
/// use itertools::Itertools;
4305
- /// use itertools::MinMaxResult::{NoElements, OneElement, MinMax };
4303
+ /// use itertools::MinMaxResult::{MinMax, NoElements, OneElement };
4306
4304
///
4307
4305
/// let a: [i32; 0] = [];
4308
4306
/// assert_eq!(a.iter().position_minmax(), NoElements);
@@ -4347,7 +4345,7 @@ pub trait Itertools: Iterator {
4347
4345
///
4348
4346
/// ```
4349
4347
/// use itertools::Itertools;
4350
- /// use itertools::MinMaxResult::{NoElements, OneElement, MinMax };
4348
+ /// use itertools::MinMaxResult::{MinMax, NoElements, OneElement };
4351
4349
///
4352
4350
/// let a: [i32; 0] = [];
4353
4351
/// assert_eq!(a.iter().position_minmax_by_key(|x| x.abs()), NoElements);
@@ -4392,7 +4390,7 @@ pub trait Itertools: Iterator {
4392
4390
///
4393
4391
/// ```
4394
4392
/// use itertools::Itertools;
4395
- /// use itertools::MinMaxResult::{NoElements, OneElement, MinMax };
4393
+ /// use itertools::MinMaxResult::{MinMax, NoElements, OneElement };
4396
4394
///
4397
4395
/// let a: [i32; 0] = [];
4398
4396
/// assert_eq!(a.iter().position_minmax_by(|x, y| x.cmp(y)), NoElements);
@@ -4541,9 +4539,9 @@ pub trait Itertools: Iterator {
4541
4539
/// ```
4542
4540
/// # use itertools::Itertools;
4543
4541
/// struct Character {
4544
- /// first_name: &'static str,
4542
+ /// first_name: &'static str,
4545
4543
/// # #[allow(dead_code)]
4546
- /// last_name: &'static str,
4544
+ /// last_name: &'static str,
4547
4545
/// }
4548
4546
///
4549
4547
/// let characters =
0 commit comments