raskr / rust-autograd

Tensors and differentiable operations (like TensorFlow) in Rust
MIT License
487 stars 37 forks source link

Use `slice::iter` instead of `into_iter` to avoid future breakage #20

Closed TethysSvensson closed 5 years ago

TethysSvensson commented 5 years ago

Use slice::iter instead of into_iter to avoid future breakage

an_array.into_iter() currently just works because of the autoref feature, which then calls <[T] as IntoIterator>::into_iter. But in the future, arrays will implement IntoIterator, too. In order to avoid problems in the future, the call is replaced by iter() which is shorter and more explicit.

A crater run showed that your crate is affected by a potential future change. See https://github.com/rust-lang/rust/pull/65819 for more information.

raskr commented 5 years ago

Thank you! I think iter() is correct here too.