fix format and clippy warnings

This commit is contained in:
nathan
2022-01-23 12:14:00 +08:00
parent dccbd45a00
commit cfb589dda1
209 changed files with 2113 additions and 1296 deletions

View File

@ -18,7 +18,9 @@ lazy_static! {
static ref FLOWY_SDK: RwLock<Option<Arc<FlowySDK>>> = RwLock::new(None);
}
fn dispatch() -> Arc<EventDispatcher> { FLOWY_SDK.read().as_ref().unwrap().dispatcher() }
fn dispatch() -> Arc<EventDispatcher> {
FLOWY_SDK.read().as_ref().unwrap().dispatcher()
}
#[no_mangle]
pub extern "C" fn init_sdk(path: *mut c_char) -> i64 {
@ -85,13 +87,13 @@ async fn post_to_flutter(response: EventResponse, port: i64) {
{
Ok(_success) => {
log::trace!("[FFI]: Post data to dart success");
},
}
Err(e) => {
if let Some(msg) = e.downcast_ref::<&str>() {
log::error!("[FFI]: {:?}", msg);
} else {
log::error!("[FFI]: allo_isolate post panic");
}
},
}
}
}

View File

@ -22,5 +22,7 @@ impl FFIRequest {
}
impl std::convert::From<FFIRequest> for ModuleRequest {
fn from(ffi_request: FFIRequest) -> Self { ModuleRequest::new(ffi_request.event).payload(ffi_request.payload) }
fn from(ffi_request: FFIRequest) -> Self {
ModuleRequest::new(ffi_request.event).payload(ffi_request.payload)
}
}

View File

@ -3,13 +3,15 @@ use lib_dispatch::prelude::{EventResponse, Payload, StatusCode};
#[derive(ProtoBuf_Enum, Clone, Copy)]
pub enum FFIStatusCode {
Ok = 0,
Err = 1,
Ok = 0,
Err = 1,
Internal = 2,
}
impl std::default::Default for FFIStatusCode {
fn default() -> FFIStatusCode { FFIStatusCode::Ok }
fn default() -> FFIStatusCode {
FFIStatusCode::Ok
}
}
#[derive(ProtoBuf, Default)]