mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: calm clippy wanring when using non send with Arc (#6018)
This commit is contained in:
parent
70e96c01b3
commit
70d6351a6c
@ -62,6 +62,7 @@ struct DartAppFlowyCore {
|
||||
impl DartAppFlowyCore {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
core: Arc::new(RwLock::new(None)),
|
||||
handle: RwLock::new(None),
|
||||
sender: RwLock::new(None),
|
||||
@ -94,7 +95,6 @@ impl DartAppFlowyCore {
|
||||
}
|
||||
} else {
|
||||
warn!("Failed to acquire read lock for sender");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -207,7 +207,7 @@ impl Future for Runner {
|
||||
.await;
|
||||
|
||||
if let Some(ret) = ret {
|
||||
let _ = ret.send(resp);
|
||||
let _ = ret.send(resp).await;
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -243,19 +243,23 @@ pub extern "C" fn set_log_stream_port(port: i64) -> i32 {
|
||||
pub extern "C" fn link_me_please() {}
|
||||
|
||||
#[inline(always)]
|
||||
#[allow(clippy::blocks_in_conditions)]
|
||||
async fn post_to_flutter(response: AFPluginEventResponse, port: i64) {
|
||||
let isolate = allo_isolate::Isolate::new(port);
|
||||
if let Ok(_) = isolate
|
||||
match isolate
|
||||
.catch_unwind(async {
|
||||
let ffi_resp = FFIResponse::from(response);
|
||||
ffi_resp.into_bytes().unwrap().to_vec()
|
||||
})
|
||||
.await
|
||||
{
|
||||
Ok(_) => {
|
||||
#[cfg(feature = "sync_verbose_log")]
|
||||
trace!("[FFI]: Post data to dart success");
|
||||
} else {
|
||||
error!("[FFI]: allo_isolate post panic");
|
||||
},
|
||||
Err(err) => {
|
||||
error!("[FFI]: allo_isolate post failed: {:?}", err);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ impl EventIntegrationTest {
|
||||
authenticator,
|
||||
notification_sender,
|
||||
cleaner: Arc::new(Cleaner::new(PathBuf::from(clean_path))),
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
local_set: Arc::new(Default::default()),
|
||||
}
|
||||
}
|
||||
|
@ -261,6 +261,7 @@ impl AppFlowyCore {
|
||||
error!("Init user failed: {}", err)
|
||||
}
|
||||
}
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
let event_dispatcher = Arc::new(AFPluginDispatcher::new(
|
||||
runtime,
|
||||
make_plugins(
|
||||
|
@ -29,6 +29,7 @@ pub(crate) fn plugin_map_or_crash(plugins: Vec<AFPlugin>) -> AFPluginMap {
|
||||
let mut plugin_map: HashMap<AFPluginEvent, Arc<AFPlugin>> = HashMap::new();
|
||||
plugins.into_iter().for_each(|m| {
|
||||
let events = m.events();
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
let plugins = Arc::new(m);
|
||||
events.into_iter().for_each(|e| {
|
||||
if plugin_map.contains_key(&e) {
|
||||
@ -38,6 +39,7 @@ pub(crate) fn plugin_map_or_crash(plugins: Vec<AFPlugin>) -> AFPluginMap {
|
||||
plugin_map.insert(e, plugins.clone());
|
||||
});
|
||||
});
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
Arc::new(plugin_map)
|
||||
}
|
||||
|
||||
@ -75,6 +77,7 @@ impl std::default::Default for AFPlugin {
|
||||
Self {
|
||||
name: "".to_owned(),
|
||||
states: Default::default(),
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
event_service_factory: Arc::new(HashMap::new()),
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ pub async fn hello() -> String {
|
||||
async fn test() {
|
||||
let event = "1";
|
||||
let runtime = Arc::new(AFPluginRuntime::new().unwrap());
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
let dispatch = Arc::new(AFPluginDispatcher::new(
|
||||
runtime,
|
||||
vec![AFPlugin::new().event(event, hello)],
|
||||
|
Loading…
Reference in New Issue
Block a user