Skip to content

Commit

Permalink
nth_back wasn't stablilized until 1.37 (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-glotfelty committed Feb 10, 2020
1 parent 043b60f commit de17e1c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions strum_macros/src/macros/enum_iter.rs
Expand Up @@ -120,11 +120,7 @@ pub fn enum_iter_inner(ast: &syn::DeriveInput) -> TokenStream {

impl #impl_generics DoubleEndedIterator for #iter_name #ty_generics #where_clause {
fn next_back(&mut self) -> Option<Self::Item> {
self.nth_back(0)
}

fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
let back_idx = self.back_idx + n + 1;
let back_idx = self.back_idx + 1;

if self.idx + back_idx > #variant_count {
// We went past the end of the iterator. Freeze back_idx at #variant_count
Expand Down

0 comments on commit de17e1c

Please sign in to comment.