Skip to content
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

fix clippy warning casting u64 to usize #4604

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rtczza
Copy link

@rtczza rtczza commented May 7, 2024

fix clippy warning casting u64 to usize may truncate the value on targets with 32-bit wide pointer

clippy tips:

warning: casting `u64` to `usize` may truncate the value on targets with 32-bit wide pointers
   --> src/firecracker/examples/uffd/uffd_utils.rs:185:35
    |
185 |         let backing_memory_size = file_meta.len() as usize;
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation
    = note: requested on the command line with `-W clippy::cast-possible-truncation`
help: ... or use `try_from` and handle the error accordingly
    |
185 |         let backing_memory_size = usize::try_from(file_meta.len());
    |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


@rtczza
Copy link
Author

rtczza commented May 16, 2024

What modifications should I make to pass the CI/CD checks?

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.

None yet

2 participants