TheBevyFlock / bevy_cli

A Bevy CLI tool.
Apache License 2.0
19 stars 4 forks source link

Lint suggestion: change detection on a ZST #100

Open alice-i-cecile opened 5 days ago

alice-i-cecile commented 5 days ago

You can technically call .is_changed or use Changed on components and resources with no data. This is cursed, and likely to be removed eventually.

BD103 commented 5 days ago

Looks like this can be done with approx_ty_size(), though LayoutOff looks promising as well. LayoutCalculator and Abi seem like even better tells for ZSTs, but they might be more difficult to use.

I think this is a good idea! What specific types am I looking for? Anything before Ref and Mut?

alice-i-cecile commented 5 days ago

Any of the methods on ComponentTicks being called on a ZST, Ref<ZST>, ChangeTrackers<ZST> or Changed<ZST>. This is probably a Suspicious category lint: it technically works but...

janhohenheim commented 4 days ago

Yeah, I'd say the only place where you want to do this is macros, and there it's commonplace to disable lints already.