Skip to content

Commit 7883f59

Browse files
bors[bot]JoelMon
andauthored
Merge #633
633: Docstring improvement: `free::zip` r=phimuemue a=JoelMon The `free::zip` function had a short explanation. I went ahead and fleshed it out a bit. I also placed the code example under the `## Example` subheading. Co-authored-by: Joel Montes de Oca <[email protected]>
2 parents 5ae7bb5 + 4276476 commit 7883f59

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/free.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,23 @@ pub fn rev<I>(iterable: I) -> iter::Rev<I::IntoIter>
105105
iterable.into_iter().rev()
106106
}
107107

108-
/// Iterate `i` and `j` in lock step.
108+
/// Converts the arguments to iterators and zips them.
109109
///
110110
/// [`IntoIterator`] enabled version of [`Iterator::zip`].
111+
///
112+
/// ## Example
111113
///
112114
/// ```
113115
/// use itertools::zip;
114116
///
115-
/// let data_1 = [1, 2, 3, 4, 5];
116-
/// let data_2 = ['a', 'b', 'c'];
117117
/// let mut result: Vec<(i32, char)> = Vec::new();
118118
///
119-
/// for (a, b) in zip(&data_1, &data_2) {
119+
/// for (a, b) in zip(&[1, 2, 3, 4, 5], &['a', 'b', 'c']) {
120120
/// result.push((*a, *b));
121121
/// }
122122
/// assert_eq!(result, vec![(1, 'a'),(2, 'b'),(3, 'c')]);
123123
/// ```
124+
#[deprecated(note="Use [std::iter::zip](https://doc.rust-lang.org/std/iter/fn.zip.html) instead", since="0.10.4")]
124125
pub fn zip<I, J>(i: I, j: J) -> Zip<I::IntoIter, J::IntoIter>
125126
where I: IntoIterator,
126127
J: IntoIterator

0 commit comments

Comments
 (0)