diff --git a/.github/workflows/cron-weekly-rustfmt.yml b/.github/workflows/cron-weekly-rustfmt.yml index 944d57cb61..6114ad88f1 100644 --- a/.github/workflows/cron-weekly-rustfmt.yml +++ b/.github/workflows/cron-weekly-rustfmt.yml @@ -15,15 +15,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - # Nightly 2026-09-23 and later reformat code that stable rustfmt reverts - # (see #1118). Keep the last nightly compatible with stable CI checks. + # Pin a nightly that formats code the same way as stable rustfmt 1.11 (Rust + # 1.100), as the stable CI checks would otherwise reject its changes. - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2026-09-22 + toolchain: nightly-2026-11-12 components: rustfmt - name: Run Nightly rustfmt # Run the formatter and manually remove trailing whitespace. - run: cargo +nightly-2026-09-22 fmt && git ls-files -- '*.rs' -z | xargs sed -E -i'' -e 's/[[:space:]]+$//' + run: cargo +nightly-2026-11-12 fmt && git ls-files -- '*.rs' -z | xargs sed -E -i'' -e 's/[[:space:]]+$//' - name: Get the current date run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - name: Create Pull Request diff --git a/src/builder.rs b/src/builder.rs index f1e23f8167..30cf17a5aa 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -2832,7 +2832,8 @@ mod tests { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, page_token: Option, - ) -> impl Future> + 'static + Send { + ) -> impl Future> + 'static + Send + { PaginatedKVStore::list_paginated( &self.0, primary_namespace, diff --git a/src/chain/bitcoind.rs b/src/chain/bitcoind.rs index fe0047e6a7..ea32aac901 100644 --- a/src/chain/bitcoind.rs +++ b/src/chain/bitcoind.rs @@ -1386,7 +1386,8 @@ impl BlockSource for BitcoindClient { fn get_best_block<'a>( &'a self, - ) -> impl Future), BlockSourceError>> + 'a { + ) -> impl Future), BlockSourceError>> + 'a + { async move { match self { BitcoindClient::Rpc { rpc_client, .. } => rpc_client.get_best_block().await, diff --git a/src/data_store.rs b/src/data_store.rs index 31a714a2a5..7f851934a0 100644 --- a/src/data_store.rs +++ b/src/data_store.rs @@ -950,7 +950,8 @@ mod tests { impl KVStore for FailingStore { fn read( &self, _primary_namespace: &str, _secondary_namespace: &str, _key: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { async { Err(io::Error::new(io::ErrorKind::Other, "read failed")) } } @@ -968,7 +969,8 @@ mod tests { fn list( &self, _primary_namespace: &str, _secondary_namespace: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { async { Err(io::Error::new(io::ErrorKind::Other, "list failed")) } } } @@ -1009,7 +1011,8 @@ mod tests { impl KVStore for GatedStore { fn read( &self, primary_namespace: &str, secondary_namespace: &str, key: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { self.inner.read(primary_namespace, secondary_namespace, key) } @@ -1034,7 +1037,8 @@ mod tests { fn list( &self, primary_namespace: &str, secondary_namespace: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { self.inner.list(primary_namespace, secondary_namespace) } } @@ -1418,7 +1422,8 @@ mod tests { impl KVStore for CountingStore { fn read( &self, primary_namespace: &str, secondary_namespace: &str, key: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { self.reads.fetch_add(1, Ordering::Relaxed); self.inner.read(primary_namespace, secondary_namespace, key) } @@ -1439,7 +1444,8 @@ mod tests { fn list( &self, primary_namespace: &str, secondary_namespace: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { self.lists.fetch_add(1, Ordering::Relaxed); self.inner.list(primary_namespace, secondary_namespace) } @@ -1468,7 +1474,8 @@ mod tests { impl KVStore for WriteFailingStore { fn read( &self, primary_namespace: &str, secondary_namespace: &str, key: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { self.inner.read(primary_namespace, secondary_namespace, key) } @@ -1500,7 +1507,8 @@ mod tests { fn list( &self, primary_namespace: &str, secondary_namespace: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { self.inner.list(primary_namespace, secondary_namespace) } } @@ -1918,7 +1926,8 @@ mod tests { impl KVStore for PhantomKeyStore { fn read( &self, primary_namespace: &str, secondary_namespace: &str, key: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { self.inner.read(primary_namespace, secondary_namespace, key) } @@ -1936,7 +1945,8 @@ mod tests { fn list( &self, primary_namespace: &str, secondary_namespace: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { self.inner.list(primary_namespace, secondary_namespace) } } diff --git a/src/io/in_memory_store.rs b/src/io/in_memory_store.rs index 82418e7d5d..c9ca08d443 100644 --- a/src/io/in_memory_store.rs +++ b/src/io/in_memory_store.rs @@ -214,7 +214,8 @@ impl PaginatedKVStore for InMemoryStore { impl MigratableKVStore for InMemoryStore { fn list_all_keys( &self, - ) -> impl Future, io::Error>> + 'static + Send { + ) -> impl Future, io::Error>> + 'static + Send + { let res = self.list_all_keys_internal(); async move { res } } diff --git a/src/io/postgres_store/mod.rs b/src/io/postgres_store/mod.rs index c3d28f8aac..76c4703b49 100644 --- a/src/io/postgres_store/mod.rs +++ b/src/io/postgres_store/mod.rs @@ -486,7 +486,8 @@ impl PaginatedKVStore for PostgresStore { impl MigratableKVStore for PostgresStore { fn list_all_keys( &self, - ) -> impl Future, io::Error>> + 'static + Send { + ) -> impl Future, io::Error>> + 'static + Send + { let inner = Arc::clone(&self.inner); let runtime = self.internal_runtime(); async move { diff --git a/src/io/sqlite_store/mod.rs b/src/io/sqlite_store/mod.rs index 8848137b62..f3aaa11116 100644 --- a/src/io/sqlite_store/mod.rs +++ b/src/io/sqlite_store/mod.rs @@ -228,7 +228,8 @@ impl PaginatedKVStore for SqliteStore { impl MigratableKVStore for SqliteStore { fn list_all_keys( &self, - ) -> impl Future, io::Error>> + 'static + Send { + ) -> impl Future, io::Error>> + 'static + Send + { let inner = Arc::clone(&self.inner); let runtime = Arc::clone(&self.internal_runtime); let fut = runtime.handle().spawn_blocking(move || inner.list_all_keys_internal()); diff --git a/src/io/utils.rs b/src/io/utils.rs index 5b67a399be..40615f909c 100644 --- a/src/io/utils.rs +++ b/src/io/utils.rs @@ -88,7 +88,8 @@ pub(crate) fn read_or_generate_seed_file( } #[cfg(unix)] - let mut f = OpenOptions::new().write(true).create_new(true).mode(0o400).open(keys_seed_path)?; + let mut f = + OpenOptions::new().write(true).create_new(true).mode(0o400).open(keys_seed_path)?; #[cfg(not(unix))] let mut f = OpenOptions::new().write(true).create_new(true).open(keys_seed_path)?; diff --git a/src/io/vss_store.rs b/src/io/vss_store.rs index 8f4f9093f6..7f351b07f5 100644 --- a/src/io/vss_store.rs +++ b/src/io/vss_store.rs @@ -333,7 +333,8 @@ impl PaginatedKVStore for VssStore { impl MigratableKVStore for VssStore { fn list_all_keys( &self, - ) -> impl Future, io::Error>> + 'static + Send { + ) -> impl Future, io::Error>> + 'static + Send + { let inner = Arc::clone(&self.inner); let runtime = self.internal_runtime(); async move { diff --git a/src/liquidity/client/lsps2/router.rs b/src/liquidity/client/lsps2/router.rs index 579d07c1a6..0fdb81d818 100644 --- a/src/liquidity/client/lsps2/router.rs +++ b/src/liquidity/client/lsps2/router.rs @@ -110,7 +110,8 @@ impl Router for LSPS2Router { .network_graph .read_only() .node(&NodeId::from_pubkey(&channel.counterparty.node_id)) - .is_some() && channel.counterparty.forwarding_info.is_some() + .is_some() + && channel.counterparty.forwarding_info.is_some() }; let direct_path_has_sufficient_liquidity = amount_msats.map_or(true, |amount_msats| { if allow_mpp { diff --git a/src/liquidity/client/lsps2/state.rs b/src/liquidity/client/lsps2/state.rs index 4030059047..0d94f93d68 100644 --- a/src/liquidity/client/lsps2/state.rs +++ b/src/liquidity/client/lsps2/state.rs @@ -575,7 +575,8 @@ mod tests { impl KVStore for FailingStore { fn read( &self, _primary_namespace: &str, _secondary_namespace: &str, _key: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { async { Err(io::Error::new(io::ErrorKind::Other, "read failed")) } } @@ -593,7 +594,8 @@ mod tests { fn list( &self, _primary_namespace: &str, _secondary_namespace: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { async { Err(io::Error::new(io::ErrorKind::Other, "list failed")) } } } @@ -1080,7 +1082,8 @@ mod tests { impl KVStore for LeaseRemovalFailingStore { fn read( &self, primary_namespace: &str, secondary_namespace: &str, key: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { KVStore::read(&*self.0, primary_namespace, secondary_namespace, key) } @@ -1107,7 +1110,8 @@ mod tests { fn list( &self, primary_namespace: &str, secondary_namespace: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { KVStore::list(&*self.0, primary_namespace, secondary_namespace) } } diff --git a/src/payment/asynchronous/static_invoice_store.rs b/src/payment/asynchronous/static_invoice_store.rs index f1e2378c23..20c29a1b99 100644 --- a/src/payment/asynchronous/static_invoice_store.rs +++ b/src/payment/asynchronous/static_invoice_store.rs @@ -97,15 +97,13 @@ impl StaticInvoiceStore { ) }) }) - .or_else( - |e| { - if e.kind() == lightning::io::ErrorKind::NotFound { - Ok(None) - } else { - Err(e) - } - }, - ) + .or_else(|e| { + if e.kind() == lightning::io::ErrorKind::NotFound { + Ok(None) + } else { + Err(e) + } + }) } pub(crate) async fn handle_persist_static_invoice( diff --git a/src/payment/forwarding_store.rs b/src/payment/forwarding_store.rs index 86b7c814b8..d494911cba 100644 --- a/src/payment/forwarding_store.rs +++ b/src/payment/forwarding_store.rs @@ -1029,7 +1029,8 @@ mod forwarding_stats_tests { impl KVStore for FailRemoveForKey { fn read( &self, primary_namespace: &str, secondary_namespace: &str, key: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { self.inner.read(primary_namespace, secondary_namespace, key) } fn write( @@ -1053,7 +1054,8 @@ mod forwarding_stats_tests { } fn list( &self, primary_namespace: &str, secondary_namespace: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { self.inner.list(primary_namespace, secondary_namespace) } } diff --git a/src/peer_store.rs b/src/peer_store.rs index db5809f1f3..6856730893 100644 --- a/src/peer_store.rs +++ b/src/peer_store.rs @@ -194,7 +194,8 @@ mod tests { impl KVStore for FailingStore { fn read( &self, _primary_namespace: &str, _secondary_namespace: &str, _key: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { async { Err(io::Error::new(io::ErrorKind::Other, "read failed")) } } @@ -212,7 +213,8 @@ mod tests { fn list( &self, _primary_namespace: &str, _secondary_namespace: &str, - ) -> impl std::future::Future, io::Error>> + 'static + Send { + ) -> impl std::future::Future, io::Error>> + 'static + Send + { async { Err(io::Error::new(io::ErrorKind::Other, "list failed")) } } } diff --git a/src/types.rs b/src/types.rs index aac9c880d9..91bd872bc7 100644 --- a/src/types.rs +++ b/src/types.rs @@ -108,7 +108,8 @@ impl<'a> KVStore for dyn DynStoreTrait + 'a { impl<'a> PaginatedKVStore for dyn DynStoreTrait + 'a { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, page_token: Option, - ) -> impl Future> + Send + 'static { + ) -> impl Future> + Send + 'static + { DynStoreTrait::list_paginated_async( self, primary_namespace, @@ -156,7 +157,8 @@ impl KVStore for DynStoreRef { impl PaginatedKVStore for DynStoreRef { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, page_token: Option, - ) -> impl Future> + Send + 'static { + ) -> impl Future> + Send + 'static + { DynStoreTrait::list_paginated_async( &*self.0, primary_namespace, @@ -189,7 +191,8 @@ impl DynStoreTrait for DynStoreWrapper { fn list_async( &self, primary_namespace: &str, secondary_namespace: &str, - ) -> Pin, bitcoin::io::Error>> + Send + 'static>> { + ) -> Pin, bitcoin::io::Error>> + Send + 'static>> + { Box::pin(KVStore::list(&self.0, primary_namespace, secondary_namespace)) } diff --git a/src/wallet/mod.rs b/src/wallet/mod.rs index 5dd2ba187a..58036e60cf 100644 --- a/src/wallet/mod.rs +++ b/src/wallet/mod.rs @@ -5025,7 +5025,8 @@ mod tests { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, page_token: Option, - ) -> impl Future> + 'static + Send { + ) -> impl Future> + 'static + Send + { PaginatedKVStore::list_paginated( &*self.inner, primary_namespace, @@ -5145,7 +5146,8 @@ mod tests { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, page_token: Option, - ) -> impl Future> + 'static + Send { + ) -> impl Future> + 'static + Send + { PaginatedKVStore::list_paginated( &*self.inner, primary_namespace, @@ -5225,7 +5227,8 @@ mod tests { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, page_token: Option, - ) -> impl Future> + 'static + Send { + ) -> impl Future> + 'static + Send + { PaginatedKVStore::list_paginated( &*self.inner, primary_namespace, @@ -5788,7 +5791,8 @@ mod tests { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, _page_token: Option, - ) -> impl Future> + 'static + Send { + ) -> impl Future> + 'static + Send + { let keys = self .data .lock() @@ -5912,7 +5916,8 @@ mod tests { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, page_token: Option, - ) -> impl Future> + 'static + Send { + ) -> impl Future> + 'static + Send + { PaginatedKVStore::list_paginated( &*self.inner, primary_namespace, @@ -6120,7 +6125,8 @@ mod tests { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, page_token: Option, - ) -> impl Future> + 'static + Send { + ) -> impl Future> + 'static + Send + { PaginatedKVStore::list_paginated( &*self.inner, primary_namespace, @@ -6267,7 +6273,8 @@ mod tests { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, page_token: Option, - ) -> impl Future> + 'static + Send { + ) -> impl Future> + 'static + Send + { PaginatedKVStore::list_paginated( &*self.inner, primary_namespace, diff --git a/src/wallet/persist.rs b/src/wallet/persist.rs index 9d29b8ab90..0323c4c852 100644 --- a/src/wallet/persist.rs +++ b/src/wallet/persist.rs @@ -379,7 +379,8 @@ mod tests { fn list_paginated( &self, primary_namespace: &str, secondary_namespace: &str, page_token: Option, - ) -> impl Future> + 'static + Send { + ) -> impl Future> + 'static + Send + { PaginatedKVStore::list_paginated( &*self.inner, primary_namespace, diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 278caa461c..e733806b93 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -1925,7 +1925,8 @@ pub(crate) async fn do_channel_full_cycle( + manual_cltv_amount_msat + determined_amount_msat + keysend_amount_msat) - / 1000 - splice_out_sat; + / 1000 + - splice_out_sat; let node_a_upper_bound_sat = (premine_amount_sat - funding_amount_sat) + (funding_amount_sat - sum_of_all_payments_sat); let node_a_lower_bound_sat = node_a_upper_bound_sat - onchain_fee_buffer_sat; @@ -2079,7 +2080,8 @@ impl TestSyncStoreInner { ) -> lightning::io::Result> { let fs_res = KVStore::list(&self.fs_store, primary_namespace, secondary_namespace).await; #[cfg(feature = "storage-sqlite")] - let sqlite_res = KVStore::list(&self.sqlite_store, primary_namespace, secondary_namespace).await; + let sqlite_res = + KVStore::list(&self.sqlite_store, primary_namespace, secondary_namespace).await; let test_res = KVStore::list(&self.test_store, primary_namespace, secondary_namespace).await; diff --git a/tests/integration_tests_rust.rs b/tests/integration_tests_rust.rs index 1e43a25080..281b72b1db 100644 --- a/tests/integration_tests_rust.rs +++ b/tests/integration_tests_rust.rs @@ -7098,7 +7098,8 @@ async fn async_payment() { .filter(|n| { node.network_graph().node(n).map_or(false, |info| info.announcement_info.is_some()) }) - .count() >= 2 + .count() + >= 2 }; // Wait for everyone to see all channels and node announcements.