Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstring improvement: free::zip #633

Merged
merged 1 commit into from Aug 26, 2022

Conversation

JoelMon
Copy link
Contributor

@JoelMon JoelMon commented Jul 11, 2022

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.

src/free.rs Outdated
@@ -105,15 +105,19 @@ pub fn rev<I>(iterable: I) -> iter::Rev<I::IntoIter>
iterable.into_iter().rev()
}

/// Iterate `i` and `j` in lock step.
/// `zip()` returns a new array where each element is a tuple consisting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix: This returns an iterator, not an array, so I think the text needs to be updated.

Also, remember that the first paragraph shows in https://docs.rs/itertools/latest/itertools/index.html#functions, so it's important to have a short description of it first. A more detailed explanation of what it does it better as a separate paragraph.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and fixed the error and also made the first sentence short.

src/free.rs Show resolved Hide resolved
Copy link
Contributor Author

@JoelMon JoelMon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added fixes @scottmcm suggested.

src/free.rs Outdated
@@ -105,15 +105,19 @@ pub fn rev<I>(iterable: I) -> iter::Rev<I::IntoIter>
iterable.into_iter().rev()
}

/// Iterate `i` and `j` in lock step.
/// `zip()` returns a new array where each element is a tuple consisting
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and fixed the error and also made the first sentence short.

src/free.rs Show resolved Hide resolved
JoelMon added a commit to JoelMon/itertools that referenced this pull request Jul 11, 2022
JoelMon added a commit to JoelMon/itertools that referenced this pull request Aug 25, 2022
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.

Aslo, fixed errors in PR rust-itertools#633
@JoelMon JoelMon changed the title Docstring improvement: Added explanation of function Docstring improvement: zip Aug 25, 2022
@JoelMon JoelMon marked this pull request as draft August 25, 2022 18:35
@JoelMon
Copy link
Contributor Author

JoelMon commented Aug 25, 2022

I'm going to inline the variables so that it's easier to understand.
Same idea as #634 (comment)

@JoelMon JoelMon changed the title Docstring improvement: zip Docstring improvement: free::zip Aug 25, 2022
@JoelMon JoelMon marked this pull request as ready for review August 25, 2022 19:52
@JoelMon JoelMon requested a review from scottmcm August 25, 2022 19:52
Copy link
Member

@phimuemue phimuemue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there, thanks for this. I suggest keeping things simple, and rely on the redirection to std.

src/free.rs Show resolved Hide resolved
src/free.rs Show resolved Hide resolved
src/free.rs Outdated Show resolved Hide resolved
@JoelMon JoelMon requested review from phimuemue and removed request for scottmcm August 25, 2022 20:46
Added example and link to std::iter::zip
@phimuemue
Copy link
Member

Thank you.

bors r+

@bors
Copy link
Contributor

bors bot commented Aug 26, 2022

Build succeeded:

@bors bors bot merged commit 7883f59 into rust-itertools:master Aug 26, 2022
@JoelMon JoelMon deleted the zip_docstring_improve branch August 26, 2022 13:29
@jswrenn jswrenn added this to the 0.10.4 milestone Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants