diff --git a/src/ffi/java/ext.rs b/src/ffi/java/ext.rs index 47dd939..d841bf8 100644 --- a/src/ffi/java/ext.rs +++ b/src/ffi/java/ext.rs @@ -4,7 +4,7 @@ use jni_toolbox::jni; #[allow(non_snake_case)] #[jni(package = "mp.code", class = "Extensions")] fn version() -> String { - crate::version() + crate::version().to_string() } /// Calculate the XXH3 hash for a given String. diff --git a/src/ffi/js/ext.rs b/src/ffi/js/ext.rs index 145d634..33579ec 100644 --- a/src/ffi/js/ext.rs +++ b/src/ffi/js/ext.rs @@ -9,5 +9,5 @@ pub fn js_hash(data: String) -> i64 { /// Get the current version of the client #[napi(js_name = "version")] pub fn js_version() -> String { - crate::version() + crate::version().to_string() } diff --git a/src/ffi/lua/mod.rs b/src/ffi/lua/mod.rs index 33792d0..2e4c495 100644 --- a/src/ffi/lua/mod.rs +++ b/src/ffi/lua/mod.rs @@ -45,7 +45,7 @@ fn entrypoint(lua: &Lua) -> LuaResult { exports.set( "version", - lua.create_function(|_, ()| Ok(crate::version()))?, + lua.create_function(|_, ()| Ok(crate::version().to_string()))?, )?; // runtime diff --git a/src/ffi/python/mod.rs b/src/ffi/python/mod.rs index f703051..45bd5e5 100644 --- a/src/ffi/python/mod.rs +++ b/src/ffi/python/mod.rs @@ -134,7 +134,7 @@ impl Driver { #[pyfunction] fn version() -> String { - crate::version() + crate::version().to_string() } #[pyfunction] diff --git a/src/lib.rs b/src/lib.rs index 40c6905..739f9b2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -127,6 +127,6 @@ pub mod ffi; pub(crate) mod network; /// Get the current version of the client -pub fn version() -> String { - env!("CARGO_PKG_VERSION").to_owned() +pub fn version() -> &'static str { + env!("CARGO_PKG_VERSION") }