Fix most of "unnecessary parentheses", "unnecessary trailing semicolon" and "unused std::result::Result
" lints in the generated code
#8966
+56
−22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recently we noticed a slowdown of our build times of our relatively large slint files when we started using many many conditionals in functions.
Even incremental builds where we only changed a single string literal in an unrelated rust source file takes a minute to build, when a few months ago it took only seconds.
I checked what
rustc
was spending its time on, and it turns out it was busy generating tons and tons ofunused_paren
lints. Now this lint is#[allow]
-ed in the module, but I assume thatallow
only comes into play when printing the lints, they are still generated during compilation.(The callstack is roughly
rustc_lint::unused::UnusedDelimLint::emit_unused_delims
<=rustc_interface::passes::**early_lint_checks**
<=rustc_ast_lowering::lower_to_hir
)Another symptom of this is
looking_for_entry_point
taking a lot of time when printed byRUSTFLAGS=-Ztime-passes
We think the solution is that
slint
should generate code with these lints in the first place, instead of justallow
ing them. With the changes in the PR, our incremental builds take only seconds again.This PR is a somewhat quick-n-dirty fix for the above problems, I'd be glad to hear how else this (not adding parentheses around expressions, depending on the context) could be tackled.