diff --git a/external/if-addrs b/external/if-addrs index bf082064..d16e76ce 160000 --- a/external/if-addrs +++ b/external/if-addrs @@ -1 +1 @@ -Subproject commit bf082064c312f5eba998cca90a02c185998dce9d +Subproject commit d16e76ce1f6edb03300e3f9ee264fcd611799fdb diff --git a/external/keyring-rs b/external/keyring-rs index 6562019f..70616ea2 160000 --- a/external/keyring-rs +++ b/external/keyring-rs @@ -1 +1 @@ -Subproject commit 6562019f0b86f622ab5dcadede80f7c8c8ea1eea +Subproject commit 70616ea279ae560d0f91d23ad707c713320e3d7b diff --git a/external/keyvaluedb b/external/keyvaluedb index a0ade9c9..4971ce61 160000 --- a/external/keyvaluedb +++ b/external/keyvaluedb @@ -1 +1 @@ -Subproject commit a0ade9c9c9eafb54f240106a36edc74f34c2ebfd +Subproject commit 4971ce612e7aace83b17022132687f6f380dbbae diff --git a/veilid-core/src/attachment_manager.rs b/veilid-core/src/attachment_manager.rs index fa10493b..a58bf200 100644 --- a/veilid-core/src/attachment_manager.rs +++ b/veilid-core/src/attachment_manager.rs @@ -127,9 +127,9 @@ impl AttachmentManager { crypto: crypto.clone(), attachment_machine: CallbackStateMachine::new(), network_manager: NetworkManager::new( - config.clone(), - table_store.clone(), - crypto.clone(), + config, + table_store, + crypto, ), maintain_peers: false, peer_count: 0, diff --git a/veilid-core/src/connection_table.rs b/veilid-core/src/connection_table.rs index f8d97907..dbe96aa0 100644 --- a/veilid-core/src/connection_table.rs +++ b/veilid-core/src/connection_table.rs @@ -111,7 +111,7 @@ impl ConnectionTable { let res = inner.conn_by_addr.remove(descriptor); match res { - Some(v) => Ok(v.clone()), + Some(v) => Ok(v), None => Err(()), } } diff --git a/veilid-core/src/intf/native/protected_store.rs b/veilid-core/src/intf/native/protected_store.rs index 4353ebeb..304d7321 100644 --- a/veilid-core/src/intf/native/protected_store.rs +++ b/veilid-core/src/intf/native/protected_store.rs @@ -33,7 +33,7 @@ pub async fn save_user_secret_string( let existed = kr.get_password().is_ok(); let _ = kr .set_password(value) - .map_err(|e| format!("Failed to save user secret: {}", e).to_owned())?; + .map_err(|e| format!("Failed to save user secret: {}", e))?; Ok(existed) } @@ -43,7 +43,7 @@ pub async fn load_user_secret_string(namespace: &str, key: &str) -> Result Ok(Some(v)), Err(KeyringError::NoPasswordFound) => Ok(None), - Err(e) => Err(format!("Failed to load user secret: {}", e).to_owned()), + Err(e) => Err(format!("Failed to load user secret: {}", e)), } } @@ -53,6 +53,6 @@ pub async fn remove_user_secret_string(namespace: &str, key: &str) -> Result Ok(true), Err(KeyringError::NoPasswordFound) => Ok(false), - Err(e) => Err(format!("Failed to remove user secret: {}", e).to_owned()), + Err(e) => Err(format!("Failed to remove user secret: {}", e)), } } diff --git a/veilid-core/src/intf/table_db.rs b/veilid-core/src/intf/table_db.rs index e4a154cd..653f970e 100644 --- a/veilid-core/src/intf/table_db.rs +++ b/veilid-core/src/intf/table_db.rs @@ -32,7 +32,7 @@ impl TableDB { Self { inner: Arc::new(Mutex::new(TableDBInner { table, - table_store: table_store.clone(), + table_store, database, })), } diff --git a/veilid-core/src/lease_manager.rs b/veilid-core/src/lease_manager.rs index f7ba9260..0fc443f3 100644 --- a/veilid-core/src/lease_manager.rs +++ b/veilid-core/src/lease_manager.rs @@ -88,7 +88,7 @@ impl LeaseManager { self.inner.lock().client_relay_mode } - pub fn client_is_relay_peer_addr(&self, peer_addr: PeerAddress) -> bool { + pub fn client_is_relay_peer_addr(&self, _peer_addr: PeerAddress) -> bool { error!("unimplemented"); false } @@ -101,7 +101,7 @@ impl LeaseManager { // Server-side // Signal leases - pub fn server_has_valid_signal_lease(&self, recipient_id: &DHTKey) -> bool { + pub fn server_has_valid_signal_lease(&self, _recipient_id: &DHTKey) -> bool { error!("unimplemented"); false } @@ -143,7 +143,7 @@ impl LeaseManager { } // Relay leases - pub fn server_has_valid_relay_lease(&self, recipient_id: &DHTKey) -> bool { + pub fn server_has_valid_relay_lease(&self, _recipient_id: &DHTKey) -> bool { error!("unimplemented"); false } diff --git a/veilid-core/src/network_manager.rs b/veilid-core/src/network_manager.rs index 76d37b4a..cd6c783d 100644 --- a/veilid-core/src/network_manager.rs +++ b/veilid-core/src/network_manager.rs @@ -83,7 +83,7 @@ impl NetworkManager { pub fn new(config: VeilidConfig, table_store: TableStore, crypto: Crypto) -> Self { Self { - config: config.clone(), + config, table_store, crypto, inner: Arc::new(Mutex::new(Self::new_inner())), @@ -269,7 +269,7 @@ impl NetworkManager { .lock() .connection_add_channel_tx .as_ref() - .ok_or("connection channel isn't open yet".to_owned())? + .ok_or_else(|| "connection channel isn't open yet".to_owned())? .clone(); let this = self.clone(); let receiver_loop_future = Self::process_connection(this, descriptor, conn); diff --git a/veilid-core/src/receipt_manager.rs b/veilid-core/src/receipt_manager.rs index 25e0116c..39130e6f 100644 --- a/veilid-core/src/receipt_manager.rs +++ b/veilid-core/src/receipt_manager.rs @@ -321,7 +321,7 @@ impl ReceiptManager { let mut inner = self.inner.lock(); inner .receipts_by_nonce - .insert(receipt.get_nonce(), record.clone()); + .insert(receipt.get_nonce(), record); } pub fn record_single_shot_receipt( @@ -336,7 +336,7 @@ impl ReceiptManager { let mut inner = self.inner.lock(); inner .receipts_by_nonce - .insert(receipt.get_nonce(), record.clone()); + .insert(receipt.get_nonce(), record); } fn update_next_oldest_timestamp(inner: &mut ReceiptManagerInner) { diff --git a/veilid-core/src/routing_table/mod.rs b/veilid-core/src/routing_table/mod.rs index 20b5d372..6dd3a8fe 100644 --- a/veilid-core/src/routing_table/mod.rs +++ b/veilid-core/src/routing_table/mod.rs @@ -208,7 +208,7 @@ impl RoutingTable { "Local Dial Info: {} ({:?})", NodeDialInfoSingle { node_id: NodeId::new(inner.node_id), - dial_info: dial_info.clone() + dial_info } .to_string(), origin, @@ -284,7 +284,7 @@ impl RoutingTable { "Public Dial Info: {} ({:?}#{:?})", NodeDialInfoSingle { node_id: NodeId::new(inner.node_id), - dial_info: dial_info.clone() + dial_info } .to_string(), origin, diff --git a/veilid-core/src/tests/common/test_connection_table.rs b/veilid-core/src/tests/common/test_connection_table.rs index f5512f73..06f91ad2 100644 --- a/veilid-core/src/tests/common/test_connection_table.rs +++ b/veilid-core/src/tests/common/test_connection_table.rs @@ -81,21 +81,21 @@ pub async fn test_add_get_remove() { assert_eq!(table.get_connection(&a1), Some(entry1.clone())); assert_eq!(table.get_connection(&a1), Some(entry1.clone())); assert_eq!(table.connection_count(), 1); - assert_eq!(table.remove_connection(&a2), Ok(entry1.clone())); + assert_eq!(table.remove_connection(&a2), Ok(entry1)); assert_eq!(table.connection_count(), 0); assert_eq!(table.remove_connection(&a2), Err(())); assert_eq!(table.connection_count(), 0); assert_eq!(table.get_connection(&a2), None); assert_eq!(table.get_connection(&a1), None); assert_eq!(table.connection_count(), 0); - let entry2 = table.add_connection(a1.clone(), c1.clone()).unwrap(); + let entry2 = table.add_connection(a1, c1.clone()).unwrap(); assert_eq!(table.add_connection(a2.clone(), c1), Err(())); - let entry3 = table.add_connection(a3.clone(), c2.clone()).unwrap(); - let entry4 = table.add_connection(a4.clone(), c3.clone()).unwrap(); + let entry3 = table.add_connection(a3.clone(), c2).unwrap(); + let entry4 = table.add_connection(a4.clone(), c3).unwrap(); assert_eq!(table.connection_count(), 3); - assert_eq!(table.remove_connection(&a2), Ok(entry2.clone())); - assert_eq!(table.remove_connection(&a3), Ok(entry3.clone())); - assert_eq!(table.remove_connection(&a4), Ok(entry4.clone())); + assert_eq!(table.remove_connection(&a2), Ok(entry2)); + assert_eq!(table.remove_connection(&a3), Ok(entry3)); + assert_eq!(table.remove_connection(&a4), Ok(entry4)); assert_eq!(table.connection_count(), 0); } diff --git a/veilid-core/src/tests/common/test_host_interface.rs b/veilid-core/src/tests/common/test_host_interface.rs index fb9e0315..844f5369 100644 --- a/veilid-core/src/tests/common/test_host_interface.rs +++ b/veilid-core/src/tests/common/test_host_interface.rs @@ -111,8 +111,8 @@ pub async fn test_eventual_value() { e1_c1.resolve(3u32); }); - assert_eq!(i1.await, ()); - assert_eq!(i4.await, ()); + i1.await; + i4.await; jh.await; assert_eq!(e1.take_value(), Some(3u32)); } @@ -126,15 +126,15 @@ pub async fn test_eventual_value() { let jh = intf::spawn(async move { let i5 = e1.instance(); let i6 = e1.instance(); - assert_eq!(i1.await, ()); - assert_eq!(i5.await, ()); - assert_eq!(i6.await, ()); + i1.await; + i5.await; + i6.await; }); intf::sleep(1000).await; let resolved = e1_c1.resolve(4u16); drop(i2); drop(i3); - assert_eq!(i4.await, ()); + i4.await; resolved.await; jh.await; assert_eq!(e1_c1.take_value(), Some(4u16)); @@ -146,8 +146,8 @@ pub async fn test_eventual_value() { let i2 = e1.instance(); let e1_c1 = e1.clone(); let jh = intf::spawn(async move { - assert_eq!(i1.await, ()); - assert_eq!(i2.await, ()); + i1.await; + i2.await; }); intf::sleep(1000).await; e1_c1.resolve(5u32).await; @@ -159,8 +159,8 @@ pub async fn test_eventual_value() { let j1 = e1.instance(); let j2 = e1.instance(); let jh = intf::spawn(async move { - assert_eq!(j1.await, ()); - assert_eq!(j2.await, ()); + j1.await; + j2.await; }); intf::sleep(1000).await; e1_c1.resolve(6u32).await;