1

Add suggestion for neg_multiply lint by Gh0stm4chine · Pull Request #8144 · rust...

 2 years ago
source link: https://github.com/rust-lang/rust-clippy/pull/8144
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Member

xFrednet commented 26 days ago

It looks good to me . The pipeline failed as it was unable to apply one suggestion. This can happen when multiple suggestions overlap, but that shouldn't be the case here. I've restarted the pipeline to see if it works now.

Also thank you to @r00ster91 for the review comment

@@ -1,3 +1,4 @@

// run-rustfix

#![warn(clippy::neg_multiply)]

#![allow(clippy::no_effect, clippy::unnecessary_operation)]

Suggested change
#![allow(clippy::no_effect, clippy::unnecessary_operation)] #![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::precedence)]

The clippy::precedence lint triggers for the 0xcafe | 0xff00 * -1; expression. This causes the pipeline to fail. If you allow that lint and rerun the tests and update the output, everything should be fine upside_down_face

Copy link

Contributor

Author

@Gh0stm4chine Gh0stm4chine 25 days ago

Done smiley

Copy link

Contributor

Author

@Gh0stm4chine Gh0stm4chine 25 days ago

The pipeline fails because it can't compile the fixed code. I tested it locally, it compiles fine confused

Some tests can't be executed on Windows, if you use that it might explain this behavior. I'll check it out and try to find the problem upside_down_face

The tests fail due to the configuration of compiletest-rs. In the normal UI tests all lints inside the unused group are allowed, this is sadly not true for .fixed files. The problem can be solved by adding #![allow(unused)] to the file, as that will allow these lints and prevent the warnings that make the test fail.

(This is something I want to fix at some point, but for now, this is the best and easiest solution. Sorry that you ran into this sweat_smile)

Copy link

Contributor

Author

@Gh0stm4chine Gh0stm4chine 25 days ago

Some tests can't be executed on Windows, if you use that it might explain this behavior. I'll check it out and try to find the problem upside_down_face

Yes, I am on Windows, but actually running the test locally was failing too. I thought the problem was about compiling the .fixed file.

The tests fail due to the configuration of compiletest-rs. In the normal UI tests all lints inside the unused group are allowed, this is sadly not true for .fixed files. The problem can be solved by adding #![allow(unused)] to the file, as that will allow these lints and prevent the warnings that make the test fail.

I was not sure if the #![allow(unused)] should be added in the .fixed only even though it's a generated file ?
I added it in test file for now.

Copy link

Member

@xFrednet xFrednet 25 days ago

edited

Yes, I am on Windows, but actually running the test locally was failing too. I thought the problem was about compiling the .fixed file.

Alright, your assumption was correct, it was with the compilation of the .fixed files.

I was not sure if the #![allow(unused)] should be added in the .fixed only even though it's a generated file?
I added it in test file for now.

You did it correctly, that's what I meant +1


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK