Closed cmyr closed 4 years ago
Alternative design proposal: If we make the builder of the logger a separate type, we can then say must_use
for the whole type instead of for each method.
@piegamesde as far as I can tell the whole SimpleLogger
struct really is just a builder; you never hold onto an instance of it. An alternative solution then might be to just have #[must_use]
on SimpleLogger
itself? Not clear if there is any real advantage to either approach.
You're totally right! I'd prefer must_use
on the struct itself, but in the end it does not matter that much because we can always change it.
No worries if you don't want to take this, but was easier to write the PR than to open a discussion issue.
This will warn the user if they do not call the init() method.
This patch also tweaks the docs in a few places to highlight the need to call init.
This was motiviated because I failed to do this myself when moving to the new API, and had a confused couple minutes :)