Skip to content

warning: function check is never used #19675

Closed as duplicate of#19573
Closed as duplicate of#19573
@GaspardCulis

Description

@GaspardCulis

Versions

  • bevy: v0.16.1
  • rustc: 1.89.0-nightly (586ad391f 2025-06-15)
  • cargo: 1.89.0-nightly (fc1518ef0 2025-06-06)

What you did

cargo new bevy_clippy_warn
cd bevy_clippy_warn
cargo add bevy
use bevy::{math::Vec2, reflect::Reflect, render::render_resource::ShaderType};

#[derive(ShaderType, Debug, Clone, Reflect)]
pub struct MyMaterial {
    pub some_field: f32,
    pub some_other_field: i32,
    pub yet_another_field: Vec2,
}

fn main() {
    let material = MyMaterial {
        some_field: 69.42,
        some_other_field: 14,
        yet_another_field: Vec2::ONE,
    };

    println!("My material : {material:?}");
}

What went wrong

When compiling, I get compiler warnings:

warning: function `check` is never used
 --> src/main.rs:5:21
  |
5 |     pub some_field: f32,
  |                     ^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: function `check` is never used
 --> src/main.rs:6:27
  |
6 |     pub some_other_field: i32,
  |                           ^^^

warning: function `check` is never used
 --> src/main.rs:7:28
  |
7 |     pub yet_another_field: Vec2,
  |                            ^^^^

Additional information

Here the annoyance is that this messes up my clippy CI pipeline over at my repo which fails because of this. Tried to fix it with #[allow(dead_code)] on top of my module of on top of the struct but it doesn't help.

I guess it comes from the ShaderType proc macro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-BugAn unexpected or incorrect behaviorS-Needs-TriageThis issue needs to be labelled

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions