Skip to content

[Merged by Bors] - fix "unused" warnings when compiling with render feature but without animation - #4714

Closed
jakobhellermann wants to merge 2 commits into
bevyengine:mainfrom
jakobhellermann:fix-unused-warnings
Closed

jakobhellermann wants to merge 2 commits into
bevyengine:mainfrom
jakobhellermann:fix-unused-warnings

Conversation

@jakobhellermann

Copy link
Copy Markdown
Contributor

Objective

When running cargo check --no-default-features --features render I get

warning: unused import: `Quat`
  --> crates/bevy_gltf/src/loader.rs:11:23
   |
11 | use bevy_math::{Mat4, Quat, Vec3};
   |                       ^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: function is never used: `paths_recur`
   --> crates/bevy_gltf/src/loader.rs:542:4
    |
542 | fn paths_recur(
    |    ^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

Solution

Put these items behind #[cfg(feature = "animation")].

@jakobhellermann jakobhellermann added the C-Code-Quality A section of code that is hard to understand or change label May 10, 2022
Comment thread crates/bevy_gltf/src/loader.rs Outdated
#[cfg(feature = "bevy_animation")]
use bevy_animation::{AnimationClip, AnimationPlayer, EntityPath, Keyframes, VariableCurve};
#[cfg(feature = "bevy_animation")]
use bevy_math::Quat;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we move these imports into path_recur instead (maybe using absolute paths for the signature?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done (the imports aren't used in path_recur, but in #[cfg]d blocks in load_gltf): 83d8e47

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label May 10, 2022
@alice-i-cecile

Copy link
Copy Markdown
Member

bors r+

bors Bot pushed a commit that referenced this pull request May 10, 2022
…t `animation` (#4714)

# Objective
When running `cargo check --no-default-features --features render` I get
```rust
warning: unused import: `Quat`
  --> crates/bevy_gltf/src/loader.rs:11:23
   |
11 | use bevy_math::{Mat4, Quat, Vec3};
   |                       ^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: function is never used: `paths_recur`
   --> crates/bevy_gltf/src/loader.rs:542:4
    |
542 | fn paths_recur(
    |    ^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default
```

## Solution

Put these items behind `#[cfg(feature = "animation")]`.
@bors bors Bot changed the title fix "unused" warnings when compiling with render feature but without animation [Merged by Bors] - fix "unused" warnings when compiling with render feature but without animation May 10, 2022
@bors bors Bot closed this May 10, 2022
robtfm pushed a commit to robtfm/bevy that referenced this pull request May 17, 2022
…t `animation` (bevyengine#4714)

# Objective
When running `cargo check --no-default-features --features render` I get
```rust
warning: unused import: `Quat`
  --> crates/bevy_gltf/src/loader.rs:11:23
   |
11 | use bevy_math::{Mat4, Quat, Vec3};
   |                       ^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: function is never used: `paths_recur`
   --> crates/bevy_gltf/src/loader.rs:542:4
    |
542 | fn paths_recur(
    |    ^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default
```

## Solution

Put these items behind `#[cfg(feature = "animation")]`.
exjam pushed a commit to exjam/bevy that referenced this pull request May 22, 2022
…t `animation` (bevyengine#4714)

# Objective
When running `cargo check --no-default-features --features render` I get
```rust
warning: unused import: `Quat`
  --> crates/bevy_gltf/src/loader.rs:11:23
   |
11 | use bevy_math::{Mat4, Quat, Vec3};
   |                       ^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: function is never used: `paths_recur`
   --> crates/bevy_gltf/src/loader.rs:542:4
    |
542 | fn paths_recur(
    |    ^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default
```

## Solution

Put these items behind `#[cfg(feature = "animation")]`.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
…t `animation` (bevyengine#4714)

# Objective
When running `cargo check --no-default-features --features render` I get
```rust
warning: unused import: `Quat`
  --> crates/bevy_gltf/src/loader.rs:11:23
   |
11 | use bevy_math::{Mat4, Quat, Vec3};
   |                       ^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: function is never used: `paths_recur`
   --> crates/bevy_gltf/src/loader.rs:542:4
    |
542 | fn paths_recur(
    |    ^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default
```

## Solution

Put these items behind `#[cfg(feature = "animation")]`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Code-Quality A section of code that is hard to understand or change S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants