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
clippy: Fix remaining warnings in generated code #31844
Conversation
I am wondering if it's worth adding complexity to codegen (which is already hard), just to make clippy happy or should we use more allows. NOTE: This is not review, just me thinking out loud. |
In some cases I'm thinking the same. It's hard to find the balance between clean generated code and clean generation code. I'm also not sure if it's better to create abstractions or to keep the code mininal. For example, for the closure inside I think I stride more towards solutions that create cleaner code such as the |
Another unrelated question I had was regarding format strings. There are all types of formatting in the file ( |
This is because this script is old, before fstrings were a thing. I know that I introduced some of fstrings (if not all). I think python is generally moving towards fstrings and they are similar to what rust have, so I prefer those. Sometimes |
I think I also introduced some f strings in the last pr as well. I opened #31846 to discuss this! |
* clippy: fix warnings in generated code * clippy: fix wrap_panic closure warnings
Seems like this change has broken the nightly Linux build. Unlike the main build, we use Ubuntu 20.04 and Python 3.10 for nightly builds . Is this is an issue with code not being compatible with the python version? |
Weird. EDIT: Indeed we are: servo/components/script/build.rs Lines 67 to 89 in 585e0d6
|
* clippy: fix warnings in generated code * clippy: fix wrap_panic closure warnings
Followup to #31721. Fixes all the remaining warnings generated by
CodegenRust.py
(at least on linux).Notable changes:
CGIfElseWrapper
, nestedif {} else { if {} else {} }
statements are now converted toif {} else if {} else {}
.wrap_panic
invocations that return a result now check if the body contains an explicitreturn
statement. If it doesn't, it can get rid of an extra closure that was giving warnings.Default
implementation ofEventInit
andExtendableEventInit
to use the already definedempty
methods they have.allow
block../mach build -d
does not report any errors./mach test-tidy
does not report any errors