Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: calm clippy wanring when using non send with Arc (#6018)
Nathan.fooo70d6351a6cc0
diff --git a/frontend/rust-lib/dart-ffi/src/lib.rs b/frontend/rust-lib/dart-ffi/src/lib.rsindex b9aca0fc90..984b77697f 100644--- a/frontend/rust-lib/dart-ffi/src/lib.rs+++ b/frontend/rust-lib/dart-ffi/src/lib.rs@@ -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{- #[cfg(feature = "sync_verbose_log")]- trace!("[FFI]: Post data to dart success");- } else {- error!("[FFI]: allo_isolate post panic");+ Ok(_) => {+ #[cfg(feature = "sync_verbose_log")]+ trace!("[FFI]: Post data to dart success");+ },+ Err(err) => {+ error!("[FFI]: allo_isolate post failed: {:?}", err);+ },}}diff --git a/frontend/rust-lib/event-integration-test/src/lib.rs b/frontend/rust-lib/event-integration-test/src/lib.rsindex 1aaf4a57db..758d035841 100644--- a/frontend/rust-lib/event-integration-test/src/lib.rs+++ b/frontend/rust-lib/event-integration-test/src/lib.rs@@ -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()),}}diff --git a/frontend/rust-lib/flowy-core/src/lib.rs b/frontend/rust-lib/flowy-core/src/lib.rsindex a5d60ae703..cca75a6f54 100644--- a/frontend/rust-lib/flowy-core/src/lib.rs+++ b/frontend/rust-lib/flowy-core/src/lib.rs@@ -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(diff --git a/frontend/rust-lib/lib-dispatch/src/module/module.rs b/frontend/rust-lib/lib-dispatch/src/module/module.rsindex 12cbb0c150..54f8babad9 100644--- a/frontend/rust-lib/lib-dispatch/src/module/module.rs+++ b/frontend/rust-lib/lib-dispatch/src/module/module.rs@@ -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()),}}diff --git a/frontend/rust-lib/lib-dispatch/tests/api/module.rs b/frontend/rust-lib/lib-dispatch/tests/api/module.rsindex 27ee94a9ee..214eda32fa 100644--- a/frontend/rust-lib/lib-dispatch/tests/api/module.rs+++ b/frontend/rust-lib/lib-dispatch/tests/api/module.rs@@ -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)],