Skip to content

Commit da51546

Browse files
authored
Merge pull request #657 from tnull/2025-10-switch-to-nightly-rustfmt
Switch to `nightly` `rustfmt`
2 parents bbca7d2 + e4a0352 commit da51546

File tree

14 files changed

+65
-54
lines changed

14 files changed

+65
-54
lines changed

.github/workflows/rust.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ jobs:
3838
- name: Install Rust ${{ matrix.toolchain }} toolchain
3939
run: |
4040
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ matrix.toolchain }}
41-
rustup override set ${{ matrix.toolchain }}
4241
- name: Check formatting on Rust ${{ matrix.toolchain }}
4342
if: matrix.check-fmt
4443
run: rustup component add rustfmt && cargo fmt --all -- --check

rust-toolchain.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "nightly-2025-10-08"
3+
components = [ "rustfmt" ]
4+
profile = "minimal"

rustfmt.toml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ hard_tabs = true
44
use_field_init_shorthand = true
55
max_width = 100
66
match_block_trailing_comma = true
7-
# UNSTABLE: format_code_in_doc_comments = true
8-
# UNSTABLE: overflow_delimited_expr = true
9-
# UNSTABLE: comment_width = 100
10-
# UNSTABLE: format_macro_matchers = true
11-
# UNSTABLE: format_strings = true
12-
# UNSTABLE: group_imports = "StdExternalCrate"
13-
# UNSTABLE: reorder_imports = true
14-
# UNSTABLE: imports_granularity = "Module"
7+
format_code_in_doc_comments = true
8+
overflow_delimited_expr = true
9+
comment_width = 100
10+
format_macro_matchers = true
11+
group_imports = "StdExternalCrate"
12+
reorder_imports = true
13+
imports_granularity = "Module"
14+
normalize_comments = true
15+
normalize_doc_attributes = true
16+
style_edition = "2021"
17+
# TBD: do we want comment and string wrapping?
18+
#wrap_comments = true
19+
#format_strings = true

src/builder.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,10 +628,9 @@ impl NodeBuilder {
628628
derive_xprv(config, &seed_bytes, VSS_HARDENED_CHILD_INDEX, Arc::clone(&logger))?;
629629

630630
let lnurl_auth_xprv = vss_xprv
631-
.derive_priv(
632-
&Secp256k1::new(),
633-
&[ChildNumber::Hardened { index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX }],
634-
)
631+
.derive_priv(&Secp256k1::new(), &[ChildNumber::Hardened {
632+
index: VSS_LNURL_AUTH_HARDENED_CHILD_INDEX,
633+
}])
635634
.map_err(|e| {
636635
log_error!(logger, "Failed to derive VSS secret: {}", e);
637636
BuildError::KVStoreSetupFailed

src/chain/bitcoind.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl BitcoindChainSource {
415415

416416
pub(super) async fn update_fee_rate_estimates(&self) -> Result<(), Error> {
417417
macro_rules! get_fee_rate_update {
418-
($estimation_fut: expr) => {{
418+
($estimation_fut:expr) => {{
419419
let update_res = tokio::time::timeout(
420420
Duration::from_secs(FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS),
421421
$estimation_fut,
@@ -701,10 +701,10 @@ impl BitcoindClient {
701701
let num_blocks_json = serde_json::json!(num_blocks);
702702
let estimation_mode_json = serde_json::json!(estimation_mode);
703703
rpc_client
704-
.call_method::<FeeResponse>(
705-
"estimatesmartfee",
706-
&[num_blocks_json, estimation_mode_json],
707-
)
704+
.call_method::<FeeResponse>("estimatesmartfee", &[
705+
num_blocks_json,
706+
estimation_mode_json,
707+
])
708708
.await
709709
.map(|resp| resp.0)
710710
}

src/io/test_utils.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use lightning::ln::functional_test_utils::{
1616
use lightning::util::persist::{
1717
KVStoreSync, MonitorUpdatingPersister, KVSTORE_NAMESPACE_KEY_MAX_LEN,
1818
};
19-
2019
use lightning::util::test_utils;
2120
use lightning::{check_added_monitors, check_closed_broadcast, check_closed_event};
2221
use rand::distributions::Alphanumeric;
@@ -149,7 +148,7 @@ pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {
149148

150149
// Helper to make sure the channel is on the expected update ID.
151150
macro_rules! check_persisted_data {
152-
($expected_update_id: expr) => {
151+
($expected_update_id:expr) => {
153152
persisted_chan_data_0 = persister_0.read_all_channel_monitors_with_updates().unwrap();
154153
assert_eq!(persisted_chan_data_0.len(), 1);
155154
for (_, mon) in persisted_chan_data_0.iter() {

src/io/utils.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,14 @@ pub(crate) fn check_namespace_key_validity(
399399
}
400400

401401
macro_rules! impl_read_write_change_set_type {
402-
( $read_name: ident, $write_name: ident, $change_set_type:ty, $primary_namespace: expr, $secondary_namespace: expr, $key: expr ) => {
402+
(
403+
$read_name:ident,
404+
$write_name:ident,
405+
$change_set_type:ty,
406+
$primary_namespace:expr,
407+
$secondary_namespace:expr,
408+
$key:expr
409+
) => {
403410
pub(crate) fn $read_name<L: Deref>(
404411
kv_store: Arc<DynStore>, logger: L,
405412
) -> Result<Option<$change_set_type>, std::io::Error>

src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,21 @@
2525
//! ```no_run
2626
//! # #[cfg(not(feature = "uniffi"))]
2727
//! # {
28-
//! use ldk_node::Builder;
29-
//! use ldk_node::lightning_invoice::Bolt11Invoice;
30-
//! use ldk_node::lightning::ln::msgs::SocketAddress;
31-
//! use ldk_node::bitcoin::Network;
32-
//! use ldk_node::bitcoin::secp256k1::PublicKey;
3328
//! use std::str::FromStr;
3429
//!
30+
//! use ldk_node::bitcoin::secp256k1::PublicKey;
31+
//! use ldk_node::bitcoin::Network;
32+
//! use ldk_node::lightning::ln::msgs::SocketAddress;
33+
//! use ldk_node::lightning_invoice::Bolt11Invoice;
34+
//! use ldk_node::Builder;
35+
//!
3536
//! fn main() {
3637
//! let mut builder = Builder::new();
3738
//! builder.set_network(Network::Testnet);
3839
//! builder.set_chain_source_esplora("https://blockstream.info/testnet/api".to_string(), None);
39-
//! builder.set_gossip_source_rgs("https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string());
40+
//! builder.set_gossip_source_rgs(
41+
//! "https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string(),
42+
//! );
4043
//!
4144
//! let node = builder.build().unwrap();
4245
//!
@@ -67,7 +70,6 @@
6770
//! [`stop`]: Node::stop
6871
//! [`open_channel`]: Node::open_channel
6972
//! [`send`]: Bolt11Payment::send
70-
//!
7173
#![cfg_attr(not(feature = "uniffi"), deny(missing_docs))]
7274
#![deny(rustdoc::broken_intra_doc_links)]
7375
#![deny(rustdoc::private_intra_doc_links)]

src/payment/asynchronous/static_invoice_store.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,10 @@ mod tests {
271271
}
272272

273273
fn blinded_path() -> BlindedMessagePath {
274-
BlindedMessagePath::from_blinded_path(
275-
pubkey(40),
276-
pubkey(41),
277-
vec![
278-
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
279-
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
280-
],
281-
)
274+
BlindedMessagePath::from_blinded_path(pubkey(40), pubkey(41), vec![
275+
BlindedHop { blinded_node_id: pubkey(42), encrypted_payload: vec![0; 43] },
276+
BlindedHop { blinded_node_id: pubkey(43), encrypted_payload: vec![0; 44] },
277+
])
282278
}
283279

284280
fn pubkey(byte: u8) -> PublicKey {

src/payment/onchain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type FeeRate = bitcoin::FeeRate;
2323
type FeeRate = Arc<bitcoin::FeeRate>;
2424

2525
macro_rules! maybe_map_fee_rate_opt {
26-
($fee_rate_opt: expr) => {{
26+
($fee_rate_opt:expr) => {{
2727
#[cfg(not(feature = "uniffi"))]
2828
{
2929
$fee_rate_opt

0 commit comments

Comments
 (0)