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

Simplify `Skip::nth` and `Skip::last` implementations #68597

Merged
merged 1 commit into from Feb 18, 2020

Conversation

@ollie27
Copy link
Contributor

ollie27 commented Jan 28, 2020

The main improvement is to make last no longer recursive.

The main improvement is to make `last` no longer recursive.
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 28, 2020

r? @withoutboats

(rust_highfive has picked a reviewer for you, use r? to override)

if self.n > 0 {
// nth(n) skips n+1
if self.iter.nth(self.n - 1).is_none() {
return None;

This comment has been minimized.

Copy link
@cuviper

cuviper Jan 28, 2020

Member

I like using Try in cases like this, self.iter.nth(self.n - 1)?;

This comment has been minimized.

Copy link
@ollie27

ollie27 Feb 4, 2020

Author Contributor

That would work in this case but would make the code less symmetric with the other methods of Skip which is why I didn't use ? here.

@Dylan-DPC

This comment has been minimized.

Copy link
Member

Dylan-DPC commented Feb 16, 2020

@Amanieu

This comment has been minimized.

Copy link
Contributor

Amanieu commented Feb 17, 2020

@bors r+ rollup

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 17, 2020

📌 Commit 84f3356 has been approved by Amanieu

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Feb 17, 2020
Simplify `Skip::nth` and `Skip::last` implementations

The main improvement is to make `last` no longer recursive.
bors added a commit that referenced this pull request Feb 17, 2020
Rollup of 5 pull requests

Successful merges:

 - #67272 (recursion_limit parsing handles overflows)
 - #68597 (Simplify `Skip::nth` and `Skip::last` implementations)
 - #68767 (macOS: avoid calling pthread_self() twice)
 - #69175 (Do not ICE when encountering `yield` inside `async` block)
 - #69223 (Ignore GDB versions with broken str printing.)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Feb 17, 2020
Rollup of 5 pull requests

Successful merges:

 - #67272 (recursion_limit parsing handles overflows)
 - #68597 (Simplify `Skip::nth` and `Skip::last` implementations)
 - #68767 (macOS: avoid calling pthread_self() twice)
 - #69175 (Do not ICE when encountering `yield` inside `async` block)
 - #69223 (Ignore GDB versions with broken str printing.)

Failed merges:

r? @ghost
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 18, 2020
Simplify `Skip::nth` and `Skip::last` implementations

The main improvement is to make `last` no longer recursive.
bors added a commit that referenced this pull request Feb 18, 2020
Rollup of 8 pull requests

Successful merges:

 - #67272 (recursion_limit parsing handles overflows)
 - #68597 (Simplify `Skip::nth` and `Skip::last` implementations)
 - #68767 (macOS: avoid calling pthread_self() twice)
 - #69175 (Do not ICE when encountering `yield` inside `async` block)
 - #69223 (Ignore GDB versions with broken str printing.)
 - #69244 (configure: set LLVM flags with a value)
 - #69249 (Stabilize {f32, f64}::{LOG2_10, LOG10_2})
 - #69252 (Clean out unused directories for extra disk space)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Feb 18, 2020
Rollup of 8 pull requests

Successful merges:

 - #67272 (recursion_limit parsing handles overflows)
 - #68597 (Simplify `Skip::nth` and `Skip::last` implementations)
 - #68767 (macOS: avoid calling pthread_self() twice)
 - #69175 (Do not ICE when encountering `yield` inside `async` block)
 - #69223 (Ignore GDB versions with broken str printing.)
 - #69244 (configure: set LLVM flags with a value)
 - #69249 (Stabilize {f32, f64}::{LOG2_10, LOG10_2})
 - #69252 (Clean out unused directories for extra disk space)

Failed merges:

r? @ghost
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 18, 2020
Simplify `Skip::nth` and `Skip::last` implementations

The main improvement is to make `last` no longer recursive.
bors added a commit that referenced this pull request Feb 18, 2020
Rollup of 8 pull requests

Successful merges:

 - #67272 (recursion_limit parsing handles overflows)
 - #68597 (Simplify `Skip::nth` and `Skip::last` implementations)
 - #68767 (macOS: avoid calling pthread_self() twice)
 - #69175 (Do not ICE when encountering `yield` inside `async` block)
 - #69223 (Ignore GDB versions with broken str printing.)
 - #69244 (configure: set LLVM flags with a value)
 - #69249 (Stabilize {f32, f64}::{LOG2_10, LOG10_2})
 - #69252 (Clean out unused directories for extra disk space)

Failed merges:

r? @ghost
@bors bors merged commit 84f3356 into rust-lang:master Feb 18, 2020
4 checks passed
4 checks passed
pr Build #20200128.23 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
@ollie27 ollie27 deleted the ollie27:skip_nth_last branch Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

9 participants
You can’t perform that action at this time.