diff --git a/napi/Cargo.toml b/napi/Cargo.toml index c98efa19..fefae10e 100644 --- a/napi/Cargo.toml +++ b/napi/Cargo.toml @@ -43,7 +43,7 @@ version = "0.3" [dependencies.once_cell] optional = true -version = "1.4" +version = "1.5" [dependencies.serde] optional = true diff --git a/napi/src/env.rs b/napi/src/env.rs index 5a982b21..666fdf76 100644 --- a/napi/src/env.rs +++ b/napi/src/env.rs @@ -344,7 +344,7 @@ impl Env { pub fn create_function(&self, name: &str, callback: Callback) -> Result { let mut raw_result = ptr::null_mut(); - let name = CString::new(name.to_owned())?; + let name = CString::new(name)?; let len = name.as_bytes().len(); check_status(unsafe { sys::napi_create_function( diff --git a/napi/src/js_values/mod.rs b/napi/src/js_values/mod.rs index 65387f5f..4c212c41 100644 --- a/napi/src/js_values/mod.rs +++ b/napi/src/js_values/mod.rs @@ -269,7 +269,7 @@ macro_rules! impl_object_methods { let key = CString::new(name)?; let mut raw_value = ptr::null_mut(); check_status(unsafe { - sys::napi_get_named_property(self.0.env, self.0.value, key.as_ptr(), &mut raw_value) + sys::napi_get_named_property(self.0.env, self.0.value, key.into_raw(), &mut raw_value) })?; T::from_raw(self.0.env, raw_value) }