-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
In bevy_lint
we're making more and more lints machine applicable in preparation for an integration with cargo fix
(TheBevyFlock/bevy_cli#394). It would be really nice to test the Applicability
of specific diagnostics to ensure they remain MachineApplicable
or MaybeIncorrect
for certain situations.
For example, we have a missing_reflect
lint that checks whether the Reflect
trait can be automatically derived. When it cannot, it emits Applicability::MaybeIncorrect
instead of Applicability::MachineApplicable
.
Here is a mock syntax for specifying applicability, though I don't know how challenging it would be to implement nor do I have a strong preference:
#[derive(Reflect)]
struct Reflect(u64);
#[derive(Component)]
//~| APPLICABILITY: machine applicable
//~v ERROR: defined a component without a `Reflect` implementation
struct CanAutomaticallyDerive(Reflect);
struct NonReflect(u64);
#[derive(Component)]
//~| APPLICABILITY: maybe incorrect
//~v ERROR: defined a component without a `Reflect` implementation
struct CannotAutomaticallyDerive(NonReflect);
Metadata
Metadata
Assignees
Labels
No labels