sled
sled copied to clipboard
Fix `cargo clippy`'s `warnings` and `errors`, and do `cargo fmt --all`
- Apply cargo clippy --fix --all
- **Fix cargo clippy errors:
❯ cargo clippy --all
warning: `panic` setting is ignored for `test` profile
Checking sled v1.0.0-alpha.124 (/home/exec/Projects/github.com/spacejam/sled)
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
--> src/heap.rs:516:9
|
516 | let mut data = Vec::with_capacity(self.slot_size);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
517 | unsafe {
518 | data.set_len(self.slot_size);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninit_vec
= note: `#[deny(clippy::uninit_vec)]` on by default
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
--> src/metadata_store.rs:526:5
|
526 | reusable_frame_buffer.reserve(len + 12);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
527 | unsafe {
528 | reusable_frame_buffer.set_len(len + 12);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninit_vec
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
--> src/metadata_store.rs:592:9
|
592 | low_key_buf.reserve(low_key_len);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
593 | unsafe {
594 | low_key_buf.set_len(low_key_len);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninit_vec
error: could not compile `sled` (lib) due to 3 previous errors