From dd299001ce00413b633c1c7cbe4995afe2840f24 Mon Sep 17 00:00:00 2001 From: Ivan Folgueira Bande Date: Fri, 20 Dec 2024 18:49:49 +0100 Subject: [PATCH] simple changes to make clippy happier --- waku-bindings/src/node/filter.rs | 12 ++++-------- waku-bindings/src/node/lightpush.rs | 6 ++---- waku-bindings/src/node/management.rs | 4 +--- waku-bindings/src/node/mod.rs | 4 ++-- waku-bindings/src/node/peers.rs | 6 ++---- waku-bindings/src/node/relay.rs | 24 ++++++++---------------- waku-bindings/src/node/store.rs | 6 ++---- 7 files changed, 21 insertions(+), 41 deletions(-) diff --git a/waku-bindings/src/node/filter.rs b/waku-bindings/src/node/filter.rs index c3d237a..d9f45ab 100644 --- a/waku-bindings/src/node/filter.rs +++ b/waku-bindings/src/node/filter.rs @@ -39,15 +39,13 @@ pub async fn waku_filter_subscribe( let code = unsafe { let mut closure = result_cb; let cb = get_trampoline(&closure); - let out = waku_sys::waku_filter_subscribe( + waku_sys::waku_filter_subscribe( ctx.get_ptr(), pubsub_topic_ptr, content_topics_ptr, cb, &mut closure as *mut _ as *mut c_void, - ); - - out + ) }; notify.notified().await; // Wait until a result is received @@ -79,15 +77,13 @@ pub async fn waku_filter_unsubscribe( let code = unsafe { let mut closure = result_cb; let cb = get_trampoline(&closure); - let out = waku_sys::waku_filter_unsubscribe( + waku_sys::waku_filter_unsubscribe( ctx.get_ptr(), pubsub_topic_ptr, content_topics_topics_ptr, cb, &mut closure as *mut _ as *mut c_void, - ); - - out + ) }; notify.notified().await; // Wait until a result is received diff --git a/waku-bindings/src/node/lightpush.rs b/waku-bindings/src/node/lightpush.rs index 297c223..0161a96 100644 --- a/waku-bindings/src/node/lightpush.rs +++ b/waku-bindings/src/node/lightpush.rs @@ -40,15 +40,13 @@ pub async fn waku_lightpush_publish_message( let code = unsafe { let mut closure = result_cb; let cb = get_trampoline(&closure); - let out = waku_sys::waku_lightpush_publish( + waku_sys::waku_lightpush_publish( ctx.get_ptr(), pubsub_topic_ptr, message_ptr, cb, &mut closure as *mut _ as *mut c_void, - ); - - out + ) }; notify.notified().await; // Wait until a result is received diff --git a/waku-bindings/src/node/management.rs b/waku-bindings/src/node/management.rs index ad92a0f..107473f 100644 --- a/waku-bindings/src/node/management.rs +++ b/waku-bindings/src/node/management.rs @@ -36,9 +36,7 @@ pub async fn waku_new(config: Option) -> Result let obj_ptr = unsafe { let mut closure = result_cb; let cb = get_trampoline(&closure); - let out = waku_sys::waku_new(config_ptr, cb, &mut closure as *mut _ as *mut c_void); - - out + waku_sys::waku_new(config_ptr, cb, &mut closure as *mut _ as *mut c_void) }; notify.notified().await; // Wait until a result is received diff --git a/waku-bindings/src/node/mod.rs b/waku-bindings/src/node/mod.rs index 483c7d4..00c858b 100644 --- a/waku-bindings/src/node/mod.rs +++ b/waku-bindings/src/node/mod.rs @@ -221,7 +221,7 @@ impl WakuNodeHandle { messages.extend(response.messages); - if !response.pagination_cursor.is_some() { + if response.pagination_cursor.is_none() { break; } cursor = response.pagination_cursor; @@ -229,6 +229,6 @@ impl WakuNodeHandle { messages.reverse(); - return Ok(messages); + Ok(messages) } } diff --git a/waku-bindings/src/node/peers.rs b/waku-bindings/src/node/peers.rs index ac7616c..450a443 100644 --- a/waku-bindings/src/node/peers.rs +++ b/waku-bindings/src/node/peers.rs @@ -39,7 +39,7 @@ pub async fn waku_connect( let code = unsafe { let mut closure = result_cb; let cb = get_trampoline(&closure); - let out = waku_sys::waku_connect( + waku_sys::waku_connect( ctx.get_ptr(), address_ptr, timeout @@ -47,9 +47,7 @@ pub async fn waku_connect( .unwrap_or(0), cb, &mut closure as *mut _ as *mut c_void, - ); - - out + ) }; notify.notified().await; // Wait until a result is received diff --git a/waku-bindings/src/node/relay.rs b/waku-bindings/src/node/relay.rs index efa0360..738b3ab 100644 --- a/waku-bindings/src/node/relay.rs +++ b/waku-bindings/src/node/relay.rs @@ -46,7 +46,7 @@ pub async fn waku_create_content_topic( let code = unsafe { let mut closure = result_cb; let cb = get_trampoline(&closure); - let out = waku_sys::waku_content_topic( + waku_sys::waku_content_topic( ctx.get_ptr(), application_name_ptr, application_version, @@ -54,9 +54,7 @@ pub async fn waku_create_content_topic( encoding_ptr, cb, &mut closure as *mut _ as *mut c_void, - ); - - out + ) }; notify.notified().await; // Wait until a result is received @@ -90,7 +88,7 @@ pub async fn waku_relay_publish_message( let code = unsafe { let mut closure = result_cb; let cb = get_trampoline(&closure); - let out = waku_sys::waku_relay_publish( + waku_sys::waku_relay_publish( ctx.get_ptr(), pubsub_topic.as_ptr(), message.as_ptr(), @@ -104,9 +102,7 @@ pub async fn waku_relay_publish_message( .unwrap_or(0), cb, &mut closure as *mut _ as *mut c_void, - ); - - out + ) }; notify.notified().await; // Wait until a result is received @@ -128,14 +124,12 @@ pub async fn waku_relay_subscribe(ctx: &WakuNodeContext, pubsub_topic: &PubsubTo let code = unsafe { let mut closure = result_cb; let cb = get_trampoline(&closure); - let out = waku_sys::waku_relay_subscribe( + waku_sys::waku_relay_subscribe( ctx.get_ptr(), pubsub_topic_ptr, cb, &mut closure as *mut _ as *mut c_void, - ); - - out + ) }; notify.notified().await; // Wait until a result is received @@ -160,14 +154,12 @@ pub async fn waku_relay_unsubscribe( let code = unsafe { let mut closure = result_cb; let cb = get_trampoline(&closure); - let out = waku_sys::waku_relay_subscribe( + waku_sys::waku_relay_subscribe( ctx.get_ptr(), pubsub_topic_ptr, cb, &mut closure as *mut _ as *mut c_void, - ); - - out + ) }; notify.notified().await; // Wait until a result is received diff --git a/waku-bindings/src/node/store.rs b/waku-bindings/src/node/store.rs index d8efb34..8709a98 100644 --- a/waku-bindings/src/node/store.rs +++ b/waku-bindings/src/node/store.rs @@ -130,16 +130,14 @@ pub async fn waku_store_query( let code = unsafe { let mut closure = result_cb; let cb = get_trampoline(&closure); - let out = waku_sys::waku_store_query( + waku_sys::waku_store_query( ctx.get_ptr(), json_query_ptr, peer_addr_ptr, timeout_millis, cb, &mut closure as *mut _ as *mut c_void, - ); - - out + ) }; notify.notified().await; // Wait until a result is received