bevy_lint::lints

Module zst_query

Source
Expand description

Checks for queries that query for a zero-sized type.

§Motivation

Zero-sized types (ZSTs) are types that have no size as a result of containing no runtime data. In Bevy, such types are often used as marker components and are best used as filters.

§Example


#[derive(Component)]
struct Player;

fn move_player(mut query: Query<(&mut Transform, &Player)>) {
    // ...
}

Use instead:


#[derive(Component)]
struct Player;

fn move_player(query: Query<&mut Transform, With<Player>>) {
    // ...
}

Structs§

Statics§