Lymia/derive_setters

Add support for #[deny(missing_docs)]?

grantspassoregon opened this issue · 3 comments

For our CI, it is common to deny commits based on unresolved clippy warnings. For more mature projects, we will add #[warn(missing_docs)] to the top of the module. If I use Setters to derive setters for a struct, this produces a documentation warning that I cannot easily address.

image

From a related issue on the bytemuck crate discussed on URLO, one recommendation given was:

You could open an issue on the bytemuck repo asking the derive macro to include #[allow(missing_docs)] on the generated struct too.

Perhaps setters are generalizable such that inserting a relatively generic "Sets the value of [x] field to [arg]" as a doc comment would work as well.

Thank you,
Erik

Experimenting a bit more, I note that if I document the private fields being accessed by the setter, it clears the warning, but this is not a total win, because it duplicates the doc comment describing the field in the setter method:

image image

I can imagine writing a good doc comment for one method, or the other, but not as easily for both at once. Am I using this as intended?

I'll think about this use case. derive_getters and derive_new are by other authors, and I had not expected that this would be a possible issue when I first wrote this.