Skip to content
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

Closed

Conversation

CrazyRoka
Copy link
Contributor

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?

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Dec 6, 2021
@NiklasEi
Copy link
Member

NiklasEi commented Dec 6, 2021

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?

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 /pipelined with the appended 2).

@@ -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())
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed into_iter call

@mockersf
Copy link
Member

mockersf commented Dec 6, 2021

bors r+

bors bot pushed a commit that referenced this pull request Dec 6, 2021
# 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>
@bors bors bot changed the title Fix clippy errors related to IntoIter::new [Merged by Bors] - Fix clippy errors related to IntoIter::new Dec 6, 2021
@bors bors bot closed this Dec 6, 2021
bors bot pushed a commit that referenced this pull request Dec 8, 2021
# 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Needs-Triage This issue needs to be labelled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants