From 9e6d76b679f5481082adf7ca46a34060fdbe7832 Mon Sep 17 00:00:00 2001 From: GuilhermeWerner <26710260+GuilhermeWerner@users.noreply.github.com> Date: Tue, 21 Sep 2021 18:43:28 -0300 Subject: [PATCH] Update lib.rs --- Source/lib.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Source/lib.rs b/Source/lib.rs index 0cdfcee..858ac32 100644 --- a/Source/lib.rs +++ b/Source/lib.rs @@ -3,8 +3,6 @@ //! Jvm bindings to TribuFu SDK. #![allow(non_snake_case)] -#![allow(unused_variables)] -#![allow(unused_imports)] #[cfg(not(any( target_os = "windows", @@ -25,17 +23,17 @@ use std::ffi::{CStr, CString}; // native method. pub extern "system" fn Java_com_tribufu_sdk_TribuFu_getVersion( env: JNIEnv, - _: JClass, - j_input: JString, + _class: JClass, + input: JString, ) -> jstring { // First, we have to get the string out of Java. Check out the `strings` // module for more info on how this works. - let input = CString::from(unsafe { CStr::from_ptr(env.get_string(j_input).unwrap().as_ptr()) }); + let input = CString::from(unsafe { CStr::from_ptr(env.get_string(input).unwrap().as_ptr()) }); // Then we have to create a new Java string to return. Again, more info // in the `strings` module. - let res = env.new_string(input.to_str().unwrap()).unwrap(); + let output = env.new_string(input.to_str().unwrap()).unwrap(); // Finally, extract the raw pointer to return. - return res.into_inner(); + return output.into_inner(); }