From d52757bc0b807423119c4a03da75da453a679eb1 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Thu, 12 Nov 2026 13:00:46 -0600 Subject: [PATCH] Apply nightly rustfmt and stabilize formatting Apply the weekly nightly rustfmt changes, which regroup a few imports. rustfmt 1.11 (Rust 1.100) also wraps two expressions differently from earlier releases, so the formatting check fails on current stable. No single layout satisfies both versions, so rewrite those expressions in a form that every version formats the same way. --- ldk-server-grpc/src/grpc.rs | 6 ++---- ldk-server-macaroons/src/macaroon.rs | 3 ++- ldk-server/src/api/bolt11_receive_via_jit_channel.rs | 2 +- ldk-server/src/util/config.rs | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ldk-server-grpc/src/grpc.rs b/ldk-server-grpc/src/grpc.rs index 06deb959..d469a84d 100644 --- a/ldk-server-grpc/src/grpc.rs +++ b/ldk-server-grpc/src/grpc.rs @@ -401,10 +401,8 @@ mod tests { for b in 0u8..=127 { let s = String::from(b as char); let encoded = percent_encode(&s); - let is_unreserved = b.is_ascii_alphanumeric() - || b == b'-' || b == b'_' - || b == b'.' || b == b'~' - || b == b' '; + let is_unreserved = + b.is_ascii_alphanumeric() || matches!(b, b'-' | b'_' | b'.' | b'~' | b' '); if is_unreserved { assert_eq!(encoded, s, "byte {b:#04x} ({}) should pass through", b as char); } else { diff --git a/ldk-server-macaroons/src/macaroon.rs b/ldk-server-macaroons/src/macaroon.rs index 8982bf1e..148af5e6 100644 --- a/ldk-server-macaroons/src/macaroon.rs +++ b/ldk-server-macaroons/src/macaroon.rs @@ -13,7 +13,8 @@ //! Third-party caveats and other formats are rejected. //! Format: . -use bitcoin_hashes::{cmp::fixed_time_eq, hmac, sha256, Hash, HashEngine}; +use bitcoin_hashes::cmp::fixed_time_eq; +use bitcoin_hashes::{hmac, sha256, Hash, HashEngine}; use hex_conservative::{DisplayHex, FromHex}; /// Maximum binary token size. Hex transport uses twice this many bytes. diff --git a/ldk-server/src/api/bolt11_receive_via_jit_channel.rs b/ldk-server/src/api/bolt11_receive_via_jit_channel.rs index d96838dc..7783ff14 100644 --- a/ldk-server/src/api/bolt11_receive_via_jit_channel.rs +++ b/ldk-server/src/api/bolt11_receive_via_jit_channel.rs @@ -9,7 +9,6 @@ use std::sync::Arc; -use crate::api::error::LdkServerErrorCode::InvalidRequestError; use hex::FromHex; use ldk_node::lightning_types::payment::PaymentHash; use ldk_server_grpc::api::{ @@ -22,6 +21,7 @@ use ldk_server_grpc::api::{ }; use crate::api::error::LdkServerError; +use crate::api::error::LdkServerErrorCode::InvalidRequestError; use crate::service::Context; use crate::util::proto_adapter::proto_to_bolt11_description; diff --git a/ldk-server/src/util/config.rs b/ldk-server/src/util/config.rs index ac17743c..c767c78a 100644 --- a/ldk-server/src/util/config.rs +++ b/ldk-server/src/util/config.rs @@ -595,9 +595,9 @@ impl ConfigBuilder { let log_max_size_bytes = self.log_max_size_mb.unwrap_or(DEFAULT_LOG_MAX_SIZE_MB) * 1024 * 1024; - let log_rotation_interval_secs = - self.log_rotation_interval_hours.unwrap_or(DEFAULT_LOG_ROTATION_INTERVAL_HOURS) - * 60 * 60; + let log_rotation_interval_hours = + self.log_rotation_interval_hours.unwrap_or(DEFAULT_LOG_ROTATION_INTERVAL_HOURS); + let log_rotation_interval_secs = log_rotation_interval_hours * 60 * 60; let log_max_files = self.log_max_files.unwrap_or(DEFAULT_LOG_MAX_FILES); let log_to_file = self.log_to_file.unwrap_or(true); @@ -2375,7 +2375,7 @@ mod tests { r#" [node] network = "regtest" - + [bitcoind] rpc_address = "127.0.0.1:8332" rpc_user = "bitcoind-testuser"