rust-analyzer: It can't properly infer the type of the query entries in Bevy game engine

so when I do

fn timer_update(time: Res<Time>, mut timer: Query<&mut Timer>) {
    for mut t in timer.iter_mut() {
        t.tick(time.delta());
    }
}

I expect t to be &mut Timer (and receive proper completions), but it determines t to be <QueryIter<&mut Timer, ()> as IntoIterator>::Item

link to Bevy game engine repo: https://github.com/bevyengine/bevy link to that .iter_mut() : https://github.com/bevyengine/bevy/blob/90586a4c461cde86b8a0e08f0770894e7cf30862/crates/bevy_ecs/src/system/query.rs#L186

and seems like it is everywhere in the Bevy codebase (didn’t check that tho). It makes development harder&slower because I rely on completions very much.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments