Ad
  • Custom User Avatar

    Ah ok I see. IterTools.step is depricated, so one should use std.step.by() instead, and then no imports are needed.

  • Custom User Avatar

    I just retested, removing extern crate itertools is possible, but if I remove use itertools::Itertools; I get the error:

    error[E0599]: no method named `step` found for struct `std::slice::Iter` in the current scope
     --> src/lib.rs:4:22
      |
    4 |         array.iter().step(2).sum(),
      |                      ^^^^ method not found in `std::slice::Iter<'_, u32>`
    
    error[E0599]: no method named `step` found for struct `Skip` in the current scope
     --> src/lib.rs:5:30
      |
    5 |         array.iter().skip(1).step(2).sum()
      |                              ^^^^ method not found in `Skip<std::slice::Iter<'_, u32>>`
    
    error: aborting due to 2 previous errors
    
    For more information about this error, try `rustc --explain E0599`.
    error: could not compile `challenge`
    
    
    NOTE: Line numbers in error messages can be incorrect due to concatenation.
    

    I would guess that when the solution was made extern crate itertools; was nessesary. Rust 2018 removed the need for extern crate in a lot of cases.
    Thanks for the comment!