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 force-pushed the zip_docstring_improve branch from f4213f5 to 9f37cb1 Compare Aug 25, 2022
@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 Aug 25, 2022
@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 force-pushed the zip_docstring_improve branch from 9f37cb1 to 47f468d Compare Aug 25, 2022
@JoelMon JoelMon marked this pull request as ready for review Aug 25, 2022
@JoelMon JoelMon requested a review from scottmcm Aug 25, 2022
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 Aug 25, 2022
Added example and link to std::iter::zip
@JoelMon JoelMon force-pushed the zip_docstring_improve branch from 5d35c25 to 4276476 Compare Aug 25, 2022
@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
4 checks passed
@JoelMon JoelMon deleted the zip_docstring_improve branch Aug 26, 2022
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

3 participants