rusty-machine icon indicating copy to clipboard operation
rusty-machine copied to clipboard

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

Open martin-fink opened this issue 6 years ago • 4 comments

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.

martin-fink avatar Oct 30 '19 19:10 martin-fink

i think the into_iter are legit on the tests (vecs must be consumed as they are not used later).

tafia avatar Nov 02 '19 05:11 tafia

You are right, thanks!

martin-fink avatar Nov 02 '19 11:11 martin-fink

I'm afraid I've been away from the rust ecosystem to understand this issue without digging deeper. Should this PR be closed following @tafia 's comment?

AtheMathmo avatar Nov 06 '19 16:11 AtheMathmo

Hi there! This PR is indeed not necessary. The code changed in this PR does not lead to breakage as into_iter is called on slices, not arrays. While the change is not bad (iter() is shorter and does the same), it's not necessary.

rusty-machine regressed in our tests because of the use of matrix! from rulinalg (build log). There is already an open PR fixing the incorrect code in rulinalg: https://github.com/AtheMathmo/rulinalg/pull/200 As this seems to be also your repository, it should be fine with getting it merged?

@AtheMathmo In short: close this PR, but merge this one.

Also: please consider Rust Bus to aid with maintaining your two crates. They do maintaining for you and will find a new maintainer.

LukasKalbertodt avatar Jan 12 '20 10:01 LukasKalbertodt