Skip to content

[#49] Fix rust-latest pipeline failure due to clippy error in src/simple_api/mod.rs

Background

   Compiling yottadb v2.0.0 (/builds/YottaDB/Lang/YDBRust)
error: transmute used without annotations
    --> src/simple_api/mod.rs:1145:49
     |
1145 |         let ydb_lock_as_vplist_func = std::mem::transmute(ydb_lock_st as *const ());
     |                                                 ^^^^^^^^^ help: consider adding missing annotations: `transmute::<*const (), unsafe extern "C" fn() -> usize>`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations
     = note: `-D clippy::missing-transmute-annotations` implied by `-D clippy::all`
     = help: to override `-D clippy::all` add `#[allow(clippy::missing_transmute_annotations)]`
error: could not compile `yottadb` (lib) due to 1 previous error

Issue

Added in 1.79.0, new Rust lint rule introduced: Checks if transmute calls have all generics specified., which causes Clippy to indicate error on previously accepted code.

About why all generics' types needs to be specified, the documentation says :

If not set, some unexpected output type could be retrieved instead of the expected one, potentially leading to invalid code.

Fix

Added type specifications to transmute() call, as Clippy suggested. Check this thread for more information on types: !171 (comment 1988207467)

Edited by Erno Zalka

Merge request reports