Skip to content

Commit

Permalink
Fix doc: backticks, links, empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe-Cholet authored and jswrenn committed May 13, 2024
1 parent 5a8ab88 commit 623a0b4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/adaptors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct Interleave<I, J> {

/// Create an iterator that interleaves elements in `i` and `j`.
///
/// [`IntoIterator`] enabled version of `[Itertools::interleave]`.
/// [`IntoIterator`] enabled version of [`Itertools::interleave`](crate::Itertools::interleave).
pub fn interleave<I, J>(
i: I,
j: J,
Expand Down Expand Up @@ -471,7 +471,7 @@ where
/// A “meta iterator adaptor”. Its closure receives a reference to the iterator
/// and may pick off as many elements as it likes, to produce the next iterator element.
///
/// Iterator element type is *X*, if the return type of `F` is *Option\<X\>*.
/// Iterator element type is `X` if the return type of `F` is `Option<X>`.
///
/// See [`.batching()`](crate::Itertools::batching) for more information.
#[derive(Clone)]
Expand Down
5 changes: 3 additions & 2 deletions src/free.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ where
i.into_iter().chain(j)
}

/// Create an iterator that clones each element from &T to T
/// Create an iterator that clones each element from `&T` to `T`.
///
/// [`IntoIterator`] enabled version of [`Iterator::cloned`].
///
Expand Down Expand Up @@ -259,7 +259,7 @@ where
iterable.into_iter().min()
}

/// Combine all iterator elements into one String, separated by `sep`.
/// Combine all iterator elements into one `String`, separated by `sep`.
///
/// [`IntoIterator`] enabled version of [`Itertools::join`].
///
Expand Down Expand Up @@ -298,6 +298,7 @@ where

/// Sort all iterator elements into a new iterator in ascending order.
/// This sort is unstable (i.e., may reorder equal elements).
///
/// [`IntoIterator`] enabled version of [`Itertools::sorted_unstable`].
///
/// ```
Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ pub trait Itertools: Iterator {
/// Return an iterator adaptor that iterates over the `k`-length combinations of
/// the elements from an iterator.
///
/// Iterator element type is `Vec<Self::Item>`. The iterator produces a new Vec per iteration,
/// Iterator element type is `Vec<Self::Item>`. The iterator produces a new `Vec` per iteration,
/// and clones the iterator elements.
///
/// ```
Expand Down Expand Up @@ -1652,7 +1652,7 @@ pub trait Itertools: Iterator {
/// Return an iterator that iterates over the `k`-length combinations of
/// the elements from an iterator, with replacement.
///
/// Iterator element type is `Vec<Self::Item>`. The iterator produces a new Vec per iteration,
/// Iterator element type is `Vec<Self::Item>`. The iterator produces a new `Vec` per iteration,
/// and clones the iterator elements.
///
/// ```
Expand Down Expand Up @@ -1681,7 +1681,7 @@ pub trait Itertools: Iterator {
/// elements from an iterator.
///
/// Iterator element type is `Vec<Self::Item>` with length `k`. The iterator
/// produces a new Vec per iteration, and clones the iterator elements.
/// produces a new `Vec` per iteration, and clones the iterator elements.
///
/// If `k` is greater than the length of the input iterator, the resultant
/// iterator adaptor will be empty.
Expand Down Expand Up @@ -2096,7 +2096,7 @@ pub trait Itertools: Iterator {
/// Consume the first `n` elements from the iterator eagerly,
/// and return the same iterator again.
///
/// It works similarly to *.skip(* `n` *)* except it is eager and
/// It works similarly to `.skip(n)` except it is eager and
/// preserves the iterator type.
///
/// ```
Expand Down Expand Up @@ -2230,7 +2230,7 @@ pub trait Itertools: Iterator {
.count()
}

/// Combine all iterator elements into one String, separated by `sep`.
/// Combine all iterator elements into one `String`, separated by `sep`.
///
/// Use the `Display` implementation of each element.
///
Expand Down Expand Up @@ -4008,7 +4008,7 @@ pub trait Itertools: Iterator {
}
}

/// If the iterator yields no elements, Ok(None) will be returned. If the iterator yields
/// If the iterator yields no elements, `Ok(None)` will be returned. If the iterator yields
/// exactly one element, that element will be returned, otherwise an error will be returned
/// containing an iterator that has the same output as the input iterator.
///
Expand Down
8 changes: 4 additions & 4 deletions src/peek_nth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ impl<I> PeekNth<I>
where
I: Iterator,
{
/// Works exactly like the `peek` method in `std::iter::Peekable`
/// Works exactly like the `peek` method in [`std::iter::Peekable`].
pub fn peek(&mut self) -> Option<&I::Item> {
self.peek_nth(0)
}

/// Works exactly like the `peek_mut` method in `std::iter::Peekable`
/// Works exactly like the `peek_mut` method in [`std::iter::Peekable`].
pub fn peek_mut(&mut self) -> Option<&mut I::Item> {
self.peek_nth_mut(0)
}
Expand Down Expand Up @@ -117,7 +117,7 @@ where
self.buf.get_mut(n)
}

/// Works exactly like the `next_if` method in `std::iter::Peekable`
/// Works exactly like the `next_if` method in [`std::iter::Peekable`].
pub fn next_if(&mut self, func: impl FnOnce(&I::Item) -> bool) -> Option<I::Item> {
match self.next() {
Some(item) if func(&item) => Some(item),
Expand All @@ -129,7 +129,7 @@ where
}
}

/// Works exactly like the `next_if_eq` method in `std::iter::Peekable`
/// Works exactly like the `next_if_eq` method in [`std::iter::Peekable`].
pub fn next_if_eq<T>(&mut self, expected: &T) -> Option<I::Item>
where
T: ?Sized,
Expand Down
6 changes: 3 additions & 3 deletions src/peeking_take_while.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use std::iter::Peekable;
///
/// This is implemented by peeking adaptors like peekable and put back,
/// but also by a few iterators that can be peeked natively, like the slice’s
/// by reference iterator (`std::slice::Iter`).
/// by reference iterator ([`std::slice::Iter`]).
pub trait PeekingNext: Iterator {
/// Pass a reference to the next iterator element to the closure `accept`;
/// if `accept` returns true, return it as the next element,
/// else None.
/// if `accept` returns `true`, return it as the next element,
/// else `None`.
fn peeking_next<F>(&mut self, accept: F) -> Option<Self::Item>
where
Self: Sized,
Expand Down
3 changes: 2 additions & 1 deletion src/put_back_n_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ where
}

impl<I: Iterator> PutBackN<I> {
/// Puts x in front of the iterator.
/// Puts `x` in front of the iterator.
///
/// The values are yielded in order of the most recently put back
/// values first.
///
Expand Down

0 comments on commit 623a0b4

Please sign in to comment.