-
Notifications
You must be signed in to change notification settings - Fork 99
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
Add [must_use = ...] attributes where appropriate #292
Comments
I was looking into this and noticed that the without
vs with
What would be the preferred solution, removing the lint + adding |
Thanks for taking a look at this! The reason for the For example the
However adding a call to diff --git a/examples/si.rs b/examples/si.rs
index 7a5bd0f..1bd48f2 100644
--- a/examples/si.rs
+++ b/examples/si.rs
@@ -19,6 +19,8 @@ fn main() {
let cm = Length::format_args(centimeter, Abbreviation);
let s = Time::format_args(second, Abbreviation);
+ l1.abs();
+
// Print results of simple formulas using different output units.
println!("{} + {} = {}", m.with(l1), cm.with(l2), m.with(l1 + l2));
println!(
diff --git a/src/system.rs b/src/system.rs
index 6324553..1ed1ee1 100644
--- a/src/system.rs
+++ b/src/system.rs
@@ -718,6 +718,7 @@ macro_rules! system {
/// Computes the absolute value of `self`. Returns `NAN` if the quantity is
/// `NAN`.
#[inline(always)]
+ #[must_use = "method returns a new number and does not mutate the original value"]
pub fn abs(self) -> Self
where
V: $crate::num::Signed,
Essentially we're looking to review all public functions and determine if a |
Ah, right, thanks! I can dedicate some time to this, but scattered over a few weeks. If that's an acceptable time scale, I'll do it. |
Awesome, that would be great! |
Since
uom
was first created the[must_use = ...]
was stabilized in Version 1.27.0 (2018-06-21)! Review alluom
functions and add the attribute if necessary.The text was updated successfully, but these errors were encountered: