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 {
|
impl DartAppFlowyCore {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
#[allow(clippy::arc_with_non_send_sync)]
|
||||||
core: Arc::new(RwLock::new(None)),
|
core: Arc::new(RwLock::new(None)),
|
||||||
handle: RwLock::new(None),
|
handle: RwLock::new(None),
|
||||||
sender: RwLock::new(None),
|
sender: RwLock::new(None),
|
||||||
@ -94,7 +95,6 @@ impl DartAppFlowyCore {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warn!("Failed to acquire read lock for sender");
|
warn!("Failed to acquire read lock for sender");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ impl Future for Runner {
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
if let Some(ret) = ret {
|
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() {}
|
pub extern "C" fn link_me_please() {}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[allow(clippy::blocks_in_conditions)]
|
||||||
async fn post_to_flutter(response: AFPluginEventResponse, port: i64) {
|
async fn post_to_flutter(response: AFPluginEventResponse, port: i64) {
|
||||||
let isolate = allo_isolate::Isolate::new(port);
|
let isolate = allo_isolate::Isolate::new(port);
|
||||||
if let Ok(_) = isolate
|
match isolate
|
||||||
.catch_unwind(async {
|
.catch_unwind(async {
|
||||||
let ffi_resp = FFIResponse::from(response);
|
let ffi_resp = FFIResponse::from(response);
|
||||||
ffi_resp.into_bytes().unwrap().to_vec()
|
ffi_resp.into_bytes().unwrap().to_vec()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
#[cfg(feature = "sync_verbose_log")]
|
Ok(_) => {
|
||||||
trace!("[FFI]: Post data to dart success");
|
#[cfg(feature = "sync_verbose_log")]
|
||||||
} else {
|
trace!("[FFI]: Post data to dart success");
|
||||||
error!("[FFI]: allo_isolate post panic");
|
},
|
||||||
|
Err(err) => {
|
||||||
|
error!("[FFI]: allo_isolate post failed: {:?}", err);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ impl EventIntegrationTest {
|
|||||||
authenticator,
|
authenticator,
|
||||||
notification_sender,
|
notification_sender,
|
||||||
cleaner: Arc::new(Cleaner::new(PathBuf::from(clean_path))),
|
cleaner: Arc::new(Cleaner::new(PathBuf::from(clean_path))),
|
||||||
|
#[allow(clippy::arc_with_non_send_sync)]
|
||||||
local_set: Arc::new(Default::default()),
|
local_set: Arc::new(Default::default()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,6 +261,7 @@ impl AppFlowyCore {
|
|||||||
error!("Init user failed: {}", err)
|
error!("Init user failed: {}", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[allow(clippy::arc_with_non_send_sync)]
|
||||||
let event_dispatcher = Arc::new(AFPluginDispatcher::new(
|
let event_dispatcher = Arc::new(AFPluginDispatcher::new(
|
||||||
runtime,
|
runtime,
|
||||||
make_plugins(
|
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();
|
let mut plugin_map: HashMap<AFPluginEvent, Arc<AFPlugin>> = HashMap::new();
|
||||||
plugins.into_iter().for_each(|m| {
|
plugins.into_iter().for_each(|m| {
|
||||||
let events = m.events();
|
let events = m.events();
|
||||||
|
#[allow(clippy::arc_with_non_send_sync)]
|
||||||
let plugins = Arc::new(m);
|
let plugins = Arc::new(m);
|
||||||
events.into_iter().for_each(|e| {
|
events.into_iter().for_each(|e| {
|
||||||
if plugin_map.contains_key(&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());
|
plugin_map.insert(e, plugins.clone());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
#[allow(clippy::arc_with_non_send_sync)]
|
||||||
Arc::new(plugin_map)
|
Arc::new(plugin_map)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +77,7 @@ impl std::default::Default for AFPlugin {
|
|||||||
Self {
|
Self {
|
||||||
name: "".to_owned(),
|
name: "".to_owned(),
|
||||||
states: Default::default(),
|
states: Default::default(),
|
||||||
|
#[allow(clippy::arc_with_non_send_sync)]
|
||||||
event_service_factory: Arc::new(HashMap::new()),
|
event_service_factory: Arc::new(HashMap::new()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ pub async fn hello() -> String {
|
|||||||
async fn test() {
|
async fn test() {
|
||||||
let event = "1";
|
let event = "1";
|
||||||
let runtime = Arc::new(AFPluginRuntime::new().unwrap());
|
let runtime = Arc::new(AFPluginRuntime::new().unwrap());
|
||||||
|
#[allow(clippy::arc_with_non_send_sync)]
|
||||||
let dispatch = Arc::new(AFPluginDispatcher::new(
|
let dispatch = Arc::new(AFPluginDispatcher::new(
|
||||||
runtime,
|
runtime,
|
||||||
vec![AFPlugin::new().event(event, hello)],
|
vec![AFPlugin::new().event(event, hello)],
|
||||||
|
Loading…
Reference in New Issue
Block a user