-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[Merged by Bors] - Fix clippy errors related to IntoIter::new #3269
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
[Merged by Bors] - Fix clippy errors related to IntoIter::new #3269
Conversation
They are from the old and new renderer. For the 0.6 release, the old one will be removed and completely replaced with the new one (all the crates in |
crates/bevy_render/src/mesh/mesh.rs
Outdated
@@ -464,7 +464,7 @@ impl Mesh { | |||
let normals: Vec<_> = positions | |||
.chunks_exact(3) | |||
.map(|p| face_normal(p[0], p[1], p[2])) | |||
.flat_map(|normal| std::array::IntoIter::new([normal, normal, normal])) | |||
.flat_map(|normal| [normal, normal, normal].into_iter()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the into_iter
call necessary, wouldn't it just work to return the array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed into_iter
call
bors r+ |
# Objective Fixes recent pipeline errors: ``` error: use of deprecated associated function `std::array::IntoIter::<T, N>::new`: use `IntoIterator::into_iter` instead --> crates/bevy_render/src/mesh/mesh.rs:467:54 | 467 | .flat_map(|normal| std::array::IntoIter::new([normal, normal, normal])) | ^^^ | = note: `-D deprecated` implied by `-D warnings` Compiling bevy_render2 v0.5.0 (/home/runner/work/bevy/bevy/pipelined/bevy_render2) error: use of deprecated associated function `std::array::IntoIter::<T, N>::new`: use `IntoIterator::into_iter` instead --> pipelined/bevy_render2/src/mesh/mesh/mod.rs:287:54 | 287 | .flat_map(|normal| std::array::IntoIter::new([normal, normal, normal])) | ^^^ | = note: `-D deprecated` implied by `-D warnings` error: could not compile `bevy_render` due to previous error ``` ## Solution - Replaced `IntoIter::new` with `IntoIterator::into_iter` ## Suggestions For me it looks like two equivalent `Mesh` structs with the same methods. Should we refactor it? Or, they will be different in the near future? Co-authored-by: CrazyRoka <rokarostuk@gmail.com>
# Objective - Checks for NaN in computed NDC space coordinates, fixing unexpected NaN in a fallible (`Option<T>`) function. ## Solution - Adds a NaN check, in addition to the existing NDC bounds checks. - This is a helper function, and should have no performance impact to the engine itself. - This will help prevent hard-to-trace NaN propagation in user code, by returning `None` instead of `Some(NaN)`. Depends on #3269 for CI error fix.
Objective
Fixes recent pipeline errors:
Solution
IntoIter::new
withIntoIterator::into_iter
Suggestions
For me it looks like two equivalent
Mesh
structs with the same methods. Should we refactor it? Or, they will be different in the near future?