-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark function without side effects as must_use #228
Conversation
This hint will make the compiler warn consumers of this library if they ever call one of these functions without using its return value.
Thank you for the PR! Is this idiomatic use of the |
The docs aren't too specific: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-must_use-attribute The places where it's used here are functions that have no side effect but construct a new value. Calling them without using the return value is usually a programmer mistake (it should either be assigned or the call deleted entirely). |
Hm. You are certainly correct. And I suppose this isn’t all that different from the unused variables warnings. I’ll merge it. But, I think this is a breaking change, so I’ll stick the label on it and keep it open until we get closer to a breaking release. (I am trying to avoid the issues we had with having to forward port changes.) |
Exactly! It's more a hint that anything else. I don't think that it's breaking; at most, consumers will see a warning. And this is in case they're doing something like |
It might not strictly be breaking, but it has the potential to break CI runs without any changes and I really detest that. |
It's your call, this is trivial to rebase anyway. |
Breaking changes * Move the `flatten_into` method for converting domain names into a straight, flat form into a new `FlattenInto` trait. This trait is only implemented for types that actually are or contain domain names. ([#216]) * Marked various methods and functions that return values without side effects as `#[must_use]`. ([#228] by [@WhyNotHugo]) * Changed the signature of `FoundSrvs::merge` to use a non-mut `other`. ([#232]) New * Added support for the ZONEMD record type. ([#229] by [@xofyarg]) * Re-exported the _octseq_ crate as `dep::octseq`. ([#230]) * Added a blanket impl for mut refs to `Composer`. ([#231] by [@xofyarg])
This hint will make the compiler warn consumers of this library if they ever call one of these functions without using its return value.