-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Added comments to public functions in num.rs. #9585
Conversation
#[inline(always)] pub fn abs<T: Signed>(value: T) -> T { value.abs() } | ||
/// The positive difference of two numbers. | ||
/// | ||
/// Returns `0.0` if the number is less than or equal to `other`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only true when T
is a floating point type (which isn't guaranteed, since these are generic functions), it should possibly just be Returns zero if the number ...
.
(This also applies to most of the mentions of NaN
: that is an implementation detail of the impls for floats.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should implementation details be present somewhere? I'll remove the mentions of NaN
where I'm not explicitly mentioning types. I'll remove all mentions of NaN
if that's preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These implementation details should probably be mentioned on the implementations of Signed
for the types that have NaN
(i.e. f32
and f64
).
Er, missing the additive and multiplicative identity comments, will add those soon. |
@vky Thanks! I r+ed this. No reason to keep holding up good docs! 🏄 |
Forgot to run make tidy on that last commit, should work now. |
Would you mind rebasing into one commit? Thanks! |
Copied existing comments from other files, and added comments to functions that did not have existing comments available.
Rebased. |
Copied existing comments from other files, and added comments to functions that did not have existing comments available. cc #7511
extend `box-default` lint, add suggestion This extends the recently added `box-default` lint to also cover `Box::new(vec![])`, `Box::new(String::from(""))` and `Box::new(Vec::from([]))`. Also the lint now suggests a suitable replacement. I did not find a simple way to check whether the type is fully determined by the outside, so I at least checked for some variations to remove the turbofish in those cases. --- changelog: none
Copied existing comments from other files, and added comments to functions that did not have existing comments available.
cc #7511