firecracker-microvm / firecracker-microvm/firecracker

Use `clippy::as_conversions`

Open
#3,161 10 comments 0 reactions 0 assignees View on GitHub
Good first issue Priority: Low Status: Parked Type: Fix
Dominant language
Rust
Stars
36.7k
Forks
2.6k
Avg merge
3d 2h
Merged PRs (30d)
53

Description

From a discussion https://github.com/firecracker-microvm/firecracker/pull/3156#discussion_r986640407 it was thought utilizing the clippy lint [`clippy::as_conversions`](https://rust-lang.github.io/rust-clippy/master/#as_conversions) would introduce additional safety.

It would be good to implement this lint, either via `#![warn(clippy::as_conversions)]` or passed as a command line argument under `test_clippy.py`.

To break up this work, we can implement the following lints incrementally:

- [x] #3195
- [x] #3196
- [x] #3197
- [x] #3198
- [x] #3199
- [x] #3200
- [x] #3201
- [x] #3202
- [x] #3203
- [ ] In [`Cargo.toml`](https://github.com/firecracker-microvm/firecracker/blob/main/Cargo.toml) replace
```
ptr_as_ptr = "warn"
cast_lossless = "warn"
cast_possible_truncation = "warn"
cast_possible_wrap = "warn"
cast_sign_loss = "warn"
```
with
```
as_conversions = "warn"
```
and fix warnings.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.