Skip to content

chore: fix cargo clippy warning#139

Merged
dr-orlovsky merged 1 commit intoAluVM:masterfrom
xixishidibei:master
Apr 11, 2025
Merged

chore: fix cargo clippy warning#139
dr-orlovsky merged 1 commit intoAluVM:masterfrom
xixishidibei:master

Conversation

@xixishidibei
Copy link
Contributor

Running cargo clippy reports the following error.

warning: length comparison to zero
   --> src/library/lib.rs:137:12
    |
137 |         if self.libs.len() > 0 {
    |            ^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!self.libs.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
    = note: `#[warn(clippy::len_zero)]` on by default

warning: manually reimplementing `div_ceil`
   --> src/library/marshaller.rs:197:23
    |
197 |         let n_bytes = (cnt + self.bit_pos.to_u8() + 7) / 8;
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `(cnt + self.bit_pos.to_u8()).div_ceil(8)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
    = note: `#[warn(clippy::manual_div_ceil)]` on by default

warning: useless conversion to the same type: `core::util::Site<library::lib::LibId>`
   --> src/library/exec.rs:261:40
    |
261 |                     return Jump::Instr(site.into());
    |                                        ^^^^^^^^^^^ help: consider removing `.into()`: `site`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `#[warn(clippy::useless_conversion)]` on by default

warning: useless conversion to the same type: `core::util::Site<library::lib::LibId>`
   --> src/library/exec.rs:266:39
    |
266 |                     return Jump::Next(site.into());
    |                                       ^^^^^^^^^^^ help: consider removing `.into()`: `site`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion

warning: `aluvm` (lib) generated 4 warnings (run `cargo clippy --fix --lib -p aluvm` to apply 4 suggestions)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 14.40s

This commit resolves the issue.

@codecov
Copy link

codecov bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 57.8%. Comparing base (3e8f8ea) to head (0468ad9).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/library/exec.rs 0.0% 2 Missing ⚠️
src/library/lib.rs 0.0% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #139     +/-   ##
========================================
- Coverage    57.9%   57.8%   -0.1%     
========================================
  Files          18      18             
  Lines        1317    1309      -8     
========================================
- Hits          763     757      -6     
+ Misses        554     552      -2     
Flag Coverage Δ
rust 57.8% <25.0%> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@dr-orlovsky dr-orlovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 0468ad9

@dr-orlovsky
Copy link
Member

Thank you and congrats with the first contribution!

@dr-orlovsky dr-orlovsky merged commit c730486 into AluVM:master Apr 11, 2025
26 of 27 checks passed
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.

2 participants