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

Implement .nth_back() for iterators #686

Merged
merged 2 commits into from Sep 5, 2019

Conversation

jturner314
Copy link
Member

@jturner314 jturner314 commented Aug 16, 2019

The .nth_back() method was added to the DoubleEndedIterator trait in Rust 1.37 (released today). Providing an implementation for Baseiter and forwarding it for Iter/Mut improves performance.

The `.nth_back()` method was added to the `DoubleEndedIterator` trait
in Rust 1.37. Providing an implementation for `Baseiter` and
forwarding it for `Iter/Mut` improves performance.
@@ -564,6 +564,65 @@ fn test_fold() {
assert_eq!(a.iter().fold(0, |acc, &x| acc + x), 1);
}

#[test]
Copy link
Member

Choose a reason for hiding this comment

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

For the sake of readability, would it make sense to split these checks in multiple test cases?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I agree. I've split it up.

Copy link
Member

@LukeMathWalker LukeMathWalker left a comment

Choose a reason for hiding this comment

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

Looks good to me - just one minor comment on tests structure, but it's not critical.

@LukeMathWalker
Copy link
Member

Merging 👍

@LukeMathWalker LukeMathWalker merged commit 4976d96 into rust-ndarray:master Sep 5, 2019
@jturner314 jturner314 deleted the nth_back branch September 6, 2019 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants