You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[must_use] tells the compiler that the output of a particular function must be used, and that not using it is a bug. A perfect example of where this belongs is:
// This is a great place for #[must_use]pubfnsaturating_sub(self,other:Self) -> Self{Self(self.0.saturating_sub(other.0))}
This rust code is currently valid and gives no warnings
let a = Uint256::one();letmut b = Uint256::from(2u128);
b += a;
b.saturating_sub(a);println("{}", b.to_string());
A user might wrongly assume that saturating_sub is modifying b, when it is not. (Ask me how I know haha). This fix should be pretty easy to implement!
The text was updated successfully, but these errors were encountered:
#[must_use]
tells the compiler that the output of a particular function must be used, and that not using it is a bug. A perfect example of where this belongs is:This rust code is currently valid and gives no warnings
A user might wrongly assume that saturating_sub is modifying b, when it is not. (Ask me how I know haha). This fix should be pretty easy to implement!
The text was updated successfully, but these errors were encountered: