From 3136a8ba8559f4f1abd39ffa9f0e389075e67658 Mon Sep 17 00:00:00 2001 From: Cecylia Bocovich Date: Fri, 16 Jun 2023 11:17:57 -0400 Subject: [PATCH] Remove unsafe blocks that aren't needed --- crates/lox-wasm/src/lib.rs | 172 +++++++++++++++---------------------- 1 file changed, 69 insertions(+), 103 deletions(-) diff --git a/crates/lox-wasm/src/lib.rs b/crates/lox-wasm/src/lib.rs index 42d4845..49bb4bf 100644 --- a/crates/lox-wasm/src/lib.rs +++ b/crates/lox-wasm/src/lib.rs @@ -47,21 +47,17 @@ pub fn set_panic_hook() { #[wasm_bindgen] pub fn open_invite(invite: &[u8]) -> Result { - unsafe { - log(&format!("Using invite: {:?}", invite)); - } + log(&format!("Using invite: {:?}", invite)); let token = match lox_utils::validate(invite) { Ok(token) => token, Err(e) => return Err(JsValue::from(e.to_string())), }; let (request, state) = open_invite::request(&token); let req_state = lox_utils::OpenReqState { request, state }; - unsafe { - log(&format!( - "Formatted open invite request: {}", - serde_json::to_string(&req_state).unwrap() - )); - } + log(&format!( + "Formatted open invite request: {}", + serde_json::to_string(&req_state).unwrap() + )); Ok(serde_json::to_string(&req_state).unwrap()) } @@ -91,16 +87,14 @@ pub fn handle_new_lox_credential( bridgeline: Some(lox_cred.1), invitation: None, }; - unsafe { - log(&format!( - "Got new Lox Credential: {}", - serde_json::to_string(&lox_cred.lox_credential).unwrap() - )); - log(&format!( - "Got new bridgeline: {}", - serde_json::to_string(&lox_cred.bridgeline).unwrap() - )); - } + log(&format!( + "Got new Lox Credential: {}", + serde_json::to_string(&lox_cred.lox_credential).unwrap() + )); + log(&format!( + "Got new bridgeline: {}", + serde_json::to_string(&lox_cred.bridgeline).unwrap() + )); Ok(serde_json::to_string(&lox_cred).unwrap()) } @@ -127,12 +121,10 @@ pub fn trust_promotion(open_lox_cred: String, lox_pub: String) -> Result Result Result