-
Notifications
You must be signed in to change notification settings - Fork 91
Make CI fail if Clippy finds any warnings. #104
Conversation
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.
A few comments regarding the float comparison changes.
The rest of the changes seem pretty reasonable. At least they don't seem to break anything. :)
Actually, when looking closer, it looks to me like none of the approximate float comparisons are warranted. They are either checking if some value has changed since last time, checking against a specific value set in a test, or comparing with a value obtained by summing some integers. In all of these cases, exact comparison is the right thing to do. |
Agreed. I think I was just blindly following clippy for that lint when I made this PR. Reverted back to strict compares, added |
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.
Many of the Clippy suggestions are good, but some are really bad, making me wonder if enforcing no Clippy warnings across the repo is such a good idea after all. At least without a generous, crate-wide list of exceptions (which, it seems, is not yet possible).
Many of the changes in this PR are still fine, and could go into a "Fix some Clippy warnings" commit.
I don't know, I think the Clippy suggestions are good enough to warrant enforcement in the general case, especially in the context of an open source project where anyone can make a PR. Even moreso when other projects in the ecosystem use Clippy to help identify ecosystem-wide issues. We have historically been terrible at checking the travis output to see if we broke any Clippy lints, so I'd rather enforce them up-front. I think it's easy enough to chuck on a Finally, if a particular lint is causing us too much trouble for what it's worth, we can decide to ignore it crate-wide in the CI file, like I did for "unreadable_literal"s in this PR. |
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.
There was one literal left (the unique_id
in transfer_and_smooth
) that I think should be reverted. And then float_cmp
and needless_range_loop
added to the Clippy exceptions. Then it looks good. :)
And yes, I do agree that it makes sense to turn the warnings on, with appropriate exceptions. I think we should have the three mentioned. Two of them because they are "causing us too much trouble for what it's worth" as you say, and one because it is buggy (which together with just one false positive warrants disabling, IMO). |
So just to be explicit, the three crate-wide ignored warnings are going to be (as of this PR):
Right? |
Yes, exactly. Good idea to add a comment about the buggy |
Fail the CI tests if Clippy reports any warnings.