Skip to content

Fix some clippy lints #1400

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Fix some clippy lints #1400

wants to merge 6 commits into from

Conversation

hellow554
Copy link
Contributor

@hellow554 hellow554 commented Mar 14, 2025

This PR aims to fix some more clippy lints.

For one, I try to get the low haning fruits.

I started this PR, because I want to see, if the performance improves. It should :)

During testing I encountered a few panics, because `12 -` was wrapping
around. I think `saturating_sub` is the correct behavoir here
For now, VCD (the default) and FST are supported.
I did this, because fst supports nicer things, e.g. struct and enum
support in the wavedump.
More formats can be added later easily with this approach
warning: the `Err`-variant returned from this function is very large
    --> crates/analyzer/src/symbol_table.rs:1277:58
     |
1277 | pub fn resolve<T: Into<SymbolPathNamespace>>(path: T) -> Result<ResolveResult, ResolveError> {
     |                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the `Err`-variant is at least 736 bytes
     |
     = help: try reducing the size of `symbol_table::ResolveError`, for example by boxing large elements or replacing it with `Box<symbol_table::ResolveError>`
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err

By introducing a box, we now went down from 736 to 24 bytes!

warning: the `Err`-variant returned from this function is very large
   --> crates/analyzer/src/type_dag.rs:225:56
    |
47  |     Cyclic(Symbol, Symbol),
    |     ---------------------- the largest variant contains at least 1440 bytes
...
225 | pub fn insert_node(symbol_id: SymbolId, name: &str) -> Result<u32, DagError> {
    |                                                        ^^^^^^^^^^^^^^^^^^^^^
    |
    = help: try reducing the size of `type_dag::DagError`, for example by boxing large elements or replacing it with `Box<type_dag::DagError>`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err

Same here, but twice the amount (since `DagError` contains 2 symbols)
Copy link

codspeed-hq bot commented Mar 14, 2025

CodSpeed Performance Report

Merging #1400 will not alter performance

Comparing hellow554:perf (cf1f630) with master (5a28f76)

Summary

✅ 3 untouched benchmarks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant