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

Better document panic behaviour for Ratios with zero in denominator #84

Merged
merged 2 commits into from
Oct 29, 2020

Conversation

zetok
Copy link
Contributor

@zetok zetok commented Oct 2, 2020

No description provided.

src/lib.rs Outdated
@@ -69,7 +69,12 @@ pub type BigRational = Ratio<BigInt>;

/// These method are `const` for Rust 1.31 and later.
impl<T> Ratio<T> {
/// Creates a `Ratio` without checking for `denom == 0` or reducing.
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with the panic documentation, but please don't change the comment style.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If one commenting style should be used over the other, this should be mentioned in some coding guidelines. I haven't seen anything like that mentioned in README.md, nor was the style change caught with the CI. Perhaps this could be improved.

Regarding the change: I've used the comment style that is simply less painful to use. Feel free to change this back if you feel that it's not acceptable. Or maybe at some later point I'll come back to this PR and make the change myself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose rustfmt's normalize_comments might cover this, but that's an unstable option. Take note what is considered "normal" though, to the extent that rustfmt is prescriptive.

In the absence of explicit style guidelines, I would suggest sticking with the prevailing style when contributing to any project. The /** style for documentation is not used anywhere in this project, and you actively changed existing comments. I might be more forgiving for brand new comments, but changes should stick to their purpose.

@cuviper
Copy link
Member

cuviper commented Oct 29, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Oct 29, 2020

@bors bors bot merged commit 78a35f1 into rust-num:master Oct 29, 2020
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.

2 participants