Skip to content
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

Merged
merged 1 commit into from Oct 17, 2013
Merged

Added comments to public functions in num.rs. #9585

merged 1 commit into from Oct 17, 2013

Conversation

ghost
Copy link

@ghost ghost commented Sep 28, 2013

Copied existing comments from other files, and added comments to functions that did not have existing comments available.

cc #7511

#[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`,
Copy link
Member

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.)

Copy link
Author

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.

Copy link
Member

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).

@ghost
Copy link
Author

ghost commented Oct 8, 2013

Er, missing the additive and multiplicative identity comments, will add those soon.

@brson
Copy link
Contributor

brson commented Oct 16, 2013

@vky Thanks! I r+ed this. No reason to keep holding up good docs! 🏄

@ghost
Copy link
Author

ghost commented Oct 17, 2013

Forgot to run make tidy on that last commit, should work now.

@alexcrichton
Copy link
Member

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.
@vky
Copy link

vky commented Oct 17, 2013

Rebased.

bors added a commit that referenced this pull request Oct 17, 2013
Copied existing comments from other files, and added comments to functions that did not have existing comments available. 

cc #7511
@bors bors closed this Oct 17, 2013
@bors bors merged commit 5e1ccc6 into rust-lang:master Oct 17, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Oct 20, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants