stacks-network / clarity-wasm

`clar2wasm` is a compiler for generating WebAssembly from Clarity.
GNU General Public License v3.0
14 stars 16 forks source link

Fix new clippy warning from Rust 1.82 #536

Closed Acaccia closed 1 month ago

Acaccia commented 1 month ago

The new Rust update 1.82 created this new clippy warning that prevents the CI from passing:

error: the `Err`-variant returned from this function is very large
  --> clar2wasm/src/lib.rs:63:6
   |
49 | /     Generic {
50 | |         ast: ContractAST,
51 | |         diagnostics: Vec<Diagnostic>,
52 | |         cost_tracker: Box<LimitedCostTracker>,
53 | |     },
   | |_____- the largest variant contains at least 240 bytes
...
63 |   ) -> Result<CompileResult, CompileError> {
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: try reducing the size of `CompileError`, for example by boxing large elements or replacing it with `Box<CompileError>`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
   = note: `-D clippy::result-large-err` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::result_large_err)]`

Following the recommendation, I boxed the large element ast from CompileError::Generic.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 86.04%. Comparing base (f223dd2) to head (55ef9e8). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #536 +/- ## ========================================== - Coverage 86.12% 86.04% -0.08% ========================================== Files 45 45 Lines 21200 21095 -105 Branches 21200 21095 -105 ========================================== - Hits 18258 18152 -106 - Misses 1373 1374 +1 Partials 1569 1569 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.