Skip to content

Commit d257b8a

Browse files
committed
Replace rustfmt_excluded_files with rustfmt_skip cfg attribute
This change removes the custom `rustfmt_excluded_files` mechanism and instead uses the an attribute at the top of each excluded file. No functional changes are introduced. This simplifies formatting workflows by enabling standard `cargo fmt` and editor format-on-save features without custom scripts. The older `rustfmt` cfg attribute is used because newer formatting directives only support code blocks, which would require more effort to apply consistently. This commit focuses on improving developer experience by streamlining formatting setup, while more granular or comprehensive formatting can be addressed later.
1 parent 1156efb commit d257b8a

37 files changed

+66
-76
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ jobs:
305305
run: |
306306
rustup component add rustfmt
307307
- name: Run rustfmt checks
308-
run: ci/rustfmt.sh
308+
run: cargo fmt --check
309309

310310
incremental-mutants:
311311
runs-on: ubuntu-latest

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ display fine at any tab-length display setting. We use `rustfmt` to establish
124124
uniform coding standards throughout the codebase. Please run
125125

126126
```bash
127-
./contrib/run-rustfmt.sh
127+
cargo +1.63.0 fmt
128128
```
129129

130130
before committing and pushing any changes, as compliance will also be checked

ci/rustfmt.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

contrib/run-rustfmt.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

lightning/src/chain/chaininterface.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/chain/chainmonitor.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/chain/channelmonitor.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/chain/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/chain/onchaintx.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/chain/package.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/chain/transaction.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/async_signer_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/blinded_payment_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/chan_utils.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/chanmon_update_fail_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/channel.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/functional_test_utils.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/max_payment_path_len_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/monitor_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/offers_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/onion_payment.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
//! Utilities to decode payment onions and do contextless validation of incoming payments.
24
//!
35
//! Primarily features [`peel_payment_onion`], which allows the decoding of an onion statelessly

lightning/src/ln/onion_route_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/outbound_payment.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/peer_handler.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/priv_short_conf_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/reload_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/reorg_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/ln/shutdown_tests.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/routing/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/routing/router.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/routing/scoring.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/routing/test_utils.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

lightning/src/routing/utxo.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(rustfmt, rustfmt_skip)]
2+
13
// This file is Copyright its original authors, visible in version control
24
// history.
35
//

rustfmt_excluded_files

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)