rust-lang / git2-rs

libgit2 bindings for Rust
https://docs.rs/git2
Apache License 2.0
1.68k stars 385 forks source link

Fix warning about unused_must_use for Box::from_raw #860

Closed ehuss closed 2 years ago

ehuss commented 2 years ago

https://github.com/rust-lang/rust/pull/99270 recently added a must_use for Box::from_raw. This causes this particular line to raise a warning. This solves it by explicitly dropping the value. This code was storing a pointer to a Rust structure using Box::into_raw. This drop impl was reconstituting it as a Box in order to free the memory. However, this doesn't care about the return value as it is only doing this to then immediately drop and free the value.