Skip to content

Commit 210cfd1

Browse files
committed
rustfmt doc comments
1 parent 9fa1efb commit 210cfd1

File tree

6 files changed

+40
-43
lines changed

6 files changed

+40
-43
lines changed

src/either_or_both.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ impl<A, B> EitherOrBoth<A, B> {
421421
/// // Inserting a second value.
422422
/// let mut either = Left("what's");
423423
/// assert_eq!(*either.insert_right(9 + 10), 21 - 2);
424-
/// assert_eq!(either, Both("what's", 9+10));
424+
/// assert_eq!(either, Both("what's", 9 + 10));
425425
/// ```
426426
pub fn insert_right(&mut self, val: B) -> &mut B {
427427
match self {

src/free.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ where
119119
/// for (a, b) in zip(&[1, 2, 3, 4, 5], &['a', 'b', 'c']) {
120120
/// result.push((*a, *b));
121121
/// }
122-
/// assert_eq!(result, vec![(1, 'a'),(2, 'b'),(3, 'c')]);
122+
/// assert_eq!(result, vec![(1, 'a'), (2, 'b'), (3, 'c')]);
123123
/// ```
124124
#[deprecated(
125125
note = "Use [std::iter::zip](https://doc.rust-lang.org/std/iter/fn.zip.html) instead",
@@ -141,7 +141,7 @@ where
141141
/// ```
142142
/// use itertools::chain;
143143
///
144-
/// let mut result:Vec<i32> = Vec::new();
144+
/// let mut result: Vec<i32> = Vec::new();
145145
///
146146
/// for element in chain(&[1, 2, 3], &[4]) {
147147
/// result.push(*element);
@@ -284,8 +284,8 @@ where
284284
/// [`IntoIterator`] enabled version of [`Itertools::sorted`].
285285
///
286286
/// ```
287-
/// use itertools::sorted;
288287
/// use itertools::assert_equal;
288+
/// use itertools::sorted;
289289
///
290290
/// assert_equal(sorted("rust".chars()), "rstu".chars());
291291
/// ```
@@ -304,8 +304,8 @@ where
304304
/// [`IntoIterator`] enabled version of [`Itertools::sorted_unstable`].
305305
///
306306
/// ```
307-
/// use itertools::sorted_unstable;
308307
/// use itertools::assert_equal;
308+
/// use itertools::sorted_unstable;
309309
///
310310
/// assert_equal(sorted_unstable("rust".chars()), "rstu".chars());
311311
/// ```

src/grouping_map.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ where
139139
///
140140
/// #[derive(Debug, Default)]
141141
/// struct Accumulator {
142-
/// acc: usize,
142+
/// acc: usize,
143143
/// }
144144
///
145145
/// let lookup = (1..=7)
@@ -458,7 +458,7 @@ where
458458
///
459459
/// ```
460460
/// use itertools::Itertools;
461-
/// use itertools::MinMaxResult::{OneElement, MinMax};
461+
/// use itertools::MinMaxResult::{MinMax, OneElement};
462462
///
463463
/// let lookup = vec![1, 3, 4, 5, 7, 9, 12].into_iter()
464464
/// .into_grouping_map_by(|&n| n % 3)
@@ -488,7 +488,7 @@ where
488488
///
489489
/// ```
490490
/// use itertools::Itertools;
491-
/// use itertools::MinMaxResult::{OneElement, MinMax};
491+
/// use itertools::MinMaxResult::{MinMax, OneElement};
492492
///
493493
/// let lookup = vec![1, 3, 4, 5, 7, 9, 12].into_iter()
494494
/// .into_grouping_map_by(|&n| n % 3)
@@ -539,7 +539,7 @@ where
539539
///
540540
/// ```
541541
/// use itertools::Itertools;
542-
/// use itertools::MinMaxResult::{OneElement, MinMax};
542+
/// use itertools::MinMaxResult::{MinMax, OneElement};
543543
///
544544
/// let lookup = vec![1, 3, 4, 5, 7, 9, 12].into_iter()
545545
/// .into_grouping_map_by(|&n| n % 3)

src/lib.rs

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -384,29 +384,29 @@ macro_rules! izip {
384384
///
385385
/// Empty invocations of `chain!` expand to an invocation of [`std::iter::empty`]:
386386
/// ```
387-
/// use std::iter;
388387
/// use itertools::chain;
388+
/// use std::iter;
389389
///
390390
/// let _: iter::Empty<()> = chain!();
391391
/// let _: iter::Empty<i8> = chain!();
392392
/// ```
393393
///
394394
/// Invocations of `chain!` with one argument expand to [`arg.into_iter()`](IntoIterator):
395395
/// ```
396-
/// use std::ops::Range;
397396
/// use itertools::chain;
397+
/// use std::ops::Range;
398398
/// let _: <Range<_> as IntoIterator>::IntoIter = chain!(2..6,); // trailing comma optional!
399399
/// let _: <&[_] as IntoIterator>::IntoIter = chain!(&[2, 3, 4]);
400400
/// ```
401401
///
402402
/// Invocations of `chain!` with multiple arguments [`.into_iter()`](IntoIterator) each
403403
/// argument, and then [`chain`] them together:
404404
/// ```
405-
/// use std::{iter::*, slice};
406405
/// use itertools::{assert_equal, chain};
406+
/// use std::{iter::*, slice};
407407
///
408408
/// // 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<_>> =
410410
/// chain![once(&0), repeat(&1).take(2), &[2, 3, 5],];
411411
///
412412
/// // ...is equivalent to this:
@@ -653,7 +653,6 @@ pub trait Itertools: Iterator {
653653
///
654654
/// itertools::assert_equal(pit, vec![(0, 1), (2, 3)]);
655655
/// ```
656-
///
657656
fn batching<B, F>(self, f: F) -> Batching<Self, F>
658657
where
659658
F: FnMut(&mut Self) -> Option<B>,
@@ -1100,8 +1099,8 @@ pub trait Itertools: Iterator {
11001099
/// and remove both `i` and `j` from their respective source iterators
11011100
///
11021101
/// ```
1102+
/// use itertools::EitherOrBoth::{Both, Left, Right};
11031103
/// use itertools::Itertools;
1104-
/// use itertools::EitherOrBoth::{Left, Right, Both};
11051104
///
11061105
/// let a = vec![0, 2, 4, 6, 1].into_iter();
11071106
/// let b = (0..10).step_by(3);
@@ -1129,8 +1128,8 @@ pub trait Itertools: Iterator {
11291128
/// "less" than the second argument.
11301129
///
11311130
/// ```
1132-
/// use itertools::Itertools;
11331131
/// use itertools::Either::{Left, Right};
1132+
/// use itertools::Itertools;
11341133
///
11351134
/// let a = vec![0, 2, 4, 6, 1].into_iter();
11361135
/// let b = (0..10).step_by(3);
@@ -1543,7 +1542,6 @@ pub trait Itertools: Iterator {
15431542
/// .collect::<String>();
15441543
/// assert_eq!(decimals, "0123456789");
15451544
/// assert_eq!(hexadecimals.next(), Some('a'));
1546-
///
15471545
/// ```
15481546
fn take_while_ref<F>(&mut self, accept: F) -> TakeWhileRef<Self, F>
15491547
where
@@ -1633,8 +1631,8 @@ pub trait Itertools: Iterator {
16331631
/// // List all hexadecimal digits
16341632
/// itertools::assert_equal(
16351633
/// (0..).map(|i| std::char::from_digit(i, 16)).while_some(),
1636-
/// "0123456789abcdef".chars());
1637-
///
1634+
/// "0123456789abcdef".chars(),
1635+
/// );
16381636
/// ```
16391637
fn while_some<A>(self) -> WhileSome<Self>
16401638
where
@@ -1930,13 +1928,13 @@ pub trait Itertools: Iterator {
19301928
/// ```
19311929
/// use itertools::Itertools;
19321930
///
1933-
/// let it = (0..5).pad_using(10, |i| 2*i);
1931+
/// let it = (0..5).pad_using(10, |i| 2 * i);
19341932
/// itertools::assert_equal(it, vec![0, 1, 2, 3, 4, 10, 12, 14, 16, 18]);
19351933
///
1936-
/// let it = (0..10).pad_using(5, |i| 2*i);
1934+
/// let it = (0..10).pad_using(5, |i| 2 * i);
19371935
/// itertools::assert_equal(it, vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
19381936
///
1939-
/// let it = (0..5).pad_using(10, |i| 2*i).rev();
1937+
/// let it = (0..5).pad_using(10, |i| 2 * i).rev();
19401938
/// itertools::assert_equal(it, vec![18, 16, 14, 12, 10, 4, 3, 2, 1, 0]);
19411939
/// ```
19421940
fn pad_using<F>(self, min: usize, f: F) -> PadUsing<Self, F>
@@ -2243,7 +2241,7 @@ pub trait Itertools: Iterator {
22432241
/// assert!(data[3..5].iter().all_equal());
22442242
/// assert!(data[5..8].iter().all_equal());
22452243
///
2246-
/// let data : Option<usize> = None;
2244+
/// let data: Option<usize> = None;
22472245
/// assert!(data.into_iter().all_equal());
22482246
/// ```
22492247
fn all_equal(&mut self) -> bool
@@ -2271,7 +2269,7 @@ pub trait Itertools: Iterator {
22712269
/// assert_eq!(data[3..5].iter().all_equal_value(), Ok(&2));
22722270
/// assert_eq!(data[5..8].iter().all_equal_value(), Ok(&3));
22732271
///
2274-
/// let data : Option<usize> = None;
2272+
/// let data: Option<usize> = None;
22752273
/// assert_eq!(data.into_iter().all_equal_value(), Err(None));
22762274
/// ```
22772275
#[allow(clippy::type_complexity)]
@@ -2301,7 +2299,7 @@ pub trait Itertools: Iterator {
23012299
/// assert!(data[0..4].iter().all_unique());
23022300
/// assert!(data[1..6].iter().all_unique());
23032301
///
2304-
/// let data : Option<usize> = None;
2302+
/// let data: Option<usize> = None;
23052303
/// assert!(data.into_iter().all_unique());
23062304
/// ```
23072305
#[cfg(feature = "use_std")]
@@ -2403,8 +2401,8 @@ pub trait Itertools: Iterator {
24032401
/// # Example
24042402
///
24052403
/// ```
2406-
/// use std::{fs, io};
24072404
/// use itertools::Itertools;
2405+
/// use std::{fs, io};
24082406
///
24092407
/// fn process_dir_entries(entries: &[fs::DirEntry]) {
24102408
/// // ...
@@ -2576,8 +2574,8 @@ pub trait Itertools: Iterator {
25762574
/// this effectively results in *((0 + 1) + 2) + 3*
25772575
///
25782576
/// ```
2579-
/// use std::ops::Add;
25802577
/// use itertools::Itertools;
2578+
/// use std::ops::Add;
25812579
///
25822580
/// let values = [1, 2, -2, -1, 2, 1];
25832581
/// assert_eq!(
@@ -2616,8 +2614,8 @@ pub trait Itertools: Iterator {
26162614
/// This is the `Option` equivalent to [`fold_ok`](Itertools::fold_ok).
26172615
///
26182616
/// ```
2619-
/// use std::ops::Add;
26202617
/// use itertools::Itertools;
2618+
/// use std::ops::Add;
26212619
///
26222620
/// let mut values = vec![Some(1), Some(2), Some(-2)].into_iter();
26232621
/// assert_eq!(values.fold_options(5, Add::add), Some(5 + 1 + 2 - 2));
@@ -2832,8 +2830,8 @@ pub trait Itertools: Iterator {
28322830
/// early exit via short-circuiting.
28332831
///
28342832
/// ```
2835-
/// use itertools::Itertools;
28362833
/// use itertools::FoldWhile::{Continue, Done};
2834+
/// use itertools::Itertools;
28372835
///
28382836
/// let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
28392837
///
@@ -3662,7 +3660,7 @@ pub trait Itertools: Iterator {
36623660
/// have a distinct type.
36633661
///
36643662
/// ```
3665-
/// use itertools::{Itertools, Either};
3663+
/// use itertools::{Either, Itertools};
36663664
///
36673665
/// let successes_and_failures = vec![Ok(1), Err(false), Err(true), Ok(2)];
36683666
///
@@ -3761,17 +3759,17 @@ pub trait Itertools: Iterator {
37613759
/// let lookup: HashMap<u32,Vec<(u32, u32)>> =
37623760
/// data.clone().into_iter().into_group_map_by(|a| a.0);
37633761
///
3764-
/// assert_eq!(lookup[&0], vec![(0,10), (0,20)]);
3762+
/// assert_eq!(lookup[&0], vec![(0, 10), (0, 20)]);
37653763
/// 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)]);
37683766
///
37693767
/// assert_eq!(
37703768
/// data.into_iter()
37713769
/// .into_group_map_by(|x| x.0)
37723770
/// .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],
37753773
/// 30,
37763774
/// );
37773775
/// ```
@@ -4033,7 +4031,7 @@ pub trait Itertools: Iterator {
40334031
///
40344032
/// ```
40354033
/// use itertools::Itertools;
4036-
/// use itertools::MinMaxResult::{NoElements, OneElement, MinMax};
4034+
/// use itertools::MinMaxResult::{MinMax, NoElements, OneElement};
40374035
///
40384036
/// let a: [i32; 0] = [];
40394037
/// assert_eq!(a.iter().minmax(), NoElements);
@@ -4302,7 +4300,7 @@ pub trait Itertools: Iterator {
43024300
///
43034301
/// ```
43044302
/// use itertools::Itertools;
4305-
/// use itertools::MinMaxResult::{NoElements, OneElement, MinMax};
4303+
/// use itertools::MinMaxResult::{MinMax, NoElements, OneElement};
43064304
///
43074305
/// let a: [i32; 0] = [];
43084306
/// assert_eq!(a.iter().position_minmax(), NoElements);
@@ -4347,7 +4345,7 @@ pub trait Itertools: Iterator {
43474345
///
43484346
/// ```
43494347
/// use itertools::Itertools;
4350-
/// use itertools::MinMaxResult::{NoElements, OneElement, MinMax};
4348+
/// use itertools::MinMaxResult::{MinMax, NoElements, OneElement};
43514349
///
43524350
/// let a: [i32; 0] = [];
43534351
/// assert_eq!(a.iter().position_minmax_by_key(|x| x.abs()), NoElements);
@@ -4392,7 +4390,7 @@ pub trait Itertools: Iterator {
43924390
///
43934391
/// ```
43944392
/// use itertools::Itertools;
4395-
/// use itertools::MinMaxResult::{NoElements, OneElement, MinMax};
4393+
/// use itertools::MinMaxResult::{MinMax, NoElements, OneElement};
43964394
///
43974395
/// let a: [i32; 0] = [];
43984396
/// assert_eq!(a.iter().position_minmax_by(|x, y| x.cmp(y)), NoElements);
@@ -4541,9 +4539,9 @@ pub trait Itertools: Iterator {
45414539
/// ```
45424540
/// # use itertools::Itertools;
45434541
/// struct Character {
4544-
/// first_name: &'static str,
4542+
/// first_name: &'static str,
45454543
/// # #[allow(dead_code)]
4546-
/// last_name: &'static str,
4544+
/// last_name: &'static str,
45474545
/// }
45484546
///
45494547
/// let characters =

src/minmax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<T: Clone> MinMaxResult<T> {
2424
/// # Examples
2525
///
2626
/// ```
27-
/// use itertools::MinMaxResult::{self, NoElements, OneElement, MinMax};
27+
/// use itertools::MinMaxResult::{self, MinMax, NoElements, OneElement};
2828
///
2929
/// let r: MinMaxResult<i32> = NoElements;
3030
/// assert_eq!(r.into_option(), None);

src/size_hint.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//! Arithmetic on `Iterator.size_hint()` values.
2-
//!
32
43
use std::cmp;
54

0 commit comments

Comments
 (0)