Stream: t-compiler/help

Topic: Heuristic for checking if a trait can be derived?


Andy Russell (Feb 05 2020 at 02:57, on Zulip):

I'd like to add a structured suggestion to derive Debug if possible on a lint, but I'd prefer to not emit the suggestion if the derive woudn't work. Is there a way to check if the derive is possible? It's fine if there are false positives in more complex cases.

Christian Poveda (Feb 05 2020 at 02:58, on Zulip):

That sounds like something that chalk is able to do

Christian Poveda (Feb 05 2020 at 02:58, on Zulip):

but I have no idea to be honest

detrumi (Feb 05 2020 at 07:14, on Zulip):

Debug can be derived if all fields implement Debug, so you should be able to check that

detrumi (Feb 05 2020 at 07:20, on Zulip):

You could also check it recursively, adding Debug for nested types.

Andy Russell (Feb 12 2020 at 03:44, on Zulip):

I understand conceptually that I can do that, but how would I do that within a lint?

Last update: Sep 22 2020 at 01:00UTC