-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add suggestion for mul_add #4602
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.
Thanks for contributing and welcome to Clippy! 🎉
LGTM overall, only some small changes and this should be good to go
When trying to build, I got an error for a non-existent |
Yes, you need to rebase this PR on top of master. |
@@ -0,0 +1,29 @@ | |||
#![warn(clippy::manual_mul_add)] |
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.
#![warn(clippy::manual_mul_add)] | |
// run-rustfix | |
#![warn(clippy::manual_mul_add)] |
I'm not sure if this will work, because some of the suggestions have to be applied one after another. If that's the case, just split up the test in a run-rustfix
file and a non-run-rustfix
file.
When testing whether a direct substitution of the suggestion would work, I noticed that I would sometimes get compilation errors because the type of a float ( |
No that would be bad. You can just make it |
What would splitting the test cases look like? Is that something I change in the uitest file with a macro or comment? |
No, it's simply to make a test file for auto fixable tests and one test file for non-autofixable tests. 😉 |
So I need to make a ‘.fixed’ file containing ‘//run-rustfix’ at the top and code where the suggestions can be substituted without error? |
No, the *.fixed file is a auto generated file. What you need to do is
|
Thanks for the clarification. I‘ll give that a try later today. I remember, however, trying to run the update script which created the .stderr file but not the .fixed file. Is there some command I run before the update script like running rustfix or cargo test? |
The |
@bors r=flip1995 |
📌 Commit 048a5f9 has been approved by |
Add suggestion for mul_add Issue #4001: Whenever `a*b+c` is found where `a`,`b`, and `c` are floats, a lint is suggested saying to use `a.mul_add(b, c)`. Using `mul_add` may give a performance boost depending on the target architecture and also has higher numerical accuracy as there is no round off when doing `a*b`. changelog: New lint: `manual_mul_add`
💔 Test failed - status-appveyor |
@EthanTheMaster This will need a rebase as the lint count recently changed |
And squashing the commits I think. |
25a4576
to
f94cbac
Compare
You need to run |
Fixed typo Fixes lint name and uses appropriate linting suggestion changed lint help message Added autofixable test Added Autofixable Test Removed Broken Autofixable File updated lints Generated Autofixable/Nonfixable Test Cases Changed Suggestion Applicability Updated Lint Count
f94cbac
to
327c91f
Compare
@bors retry |
@bors r=flip1995 |
📌 Commit 327c91f has been approved by |
Add suggestion for mul_add Issue #4001: Whenever `a*b+c` is found where `a`,`b`, and `c` are floats, a lint is suggested saying to use `a.mul_add(b, c)`. Using `mul_add` may give a performance boost depending on the target architecture and also has higher numerical accuracy as there is no round off when doing `a*b`. changelog: New lint: `manual_mul_add`
☀️ Test successful - checks-travis, status-appveyor |
Issue #4001: Whenever
a*b+c
is found wherea
,b
, andc
are floats, a lint is suggested saying to usea.mul_add(b, c)
. Usingmul_add
may give a performance boost depending on the target architecture and also has higher numerical accuracy as there is no round off when doinga*b
.changelog: New lint:
manual_mul_add