]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Only attempt to `rustfmt` files checked into git 2024-09-local-ci-rustfmt
authorMatt Corallo <git@bluematt.me>
Wed, 18 Sep 2024 18:03:11 +0000 (18:03 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 18 Sep 2024 18:04:54 +0000 (18:04 +0000)
This avoids `rustfmt` failing on Rust files generated by dependent
crates in `target`, eg

```
+ rustfmt --edition 2021 --check ./target/debug/build/thiserror-8230374e07b5c05a/out/probe.rs
Diff in /home/matt/rust-lightning-3/target/debug/build/thiserror-8230374e07b5c05a/out/probe.rs at line 1:

-    #![feature(provide_any)]
+#![feature(provide_any)]

-    use std::any::{Demand, Provider};
+use std::any::{Demand, Provider};

-    fn _f<'a, P: Provider>(p: &'a P, demand: &mut Demand<'a>) {
-        p.provide(demand);
-    }
+fn _f<'a, P: Provider>(p: &'a P, demand: &mut Demand<'a>) {
+ p.provide(demand);
+}
```

ci/rustfmt.sh
contrib/run-rustfmt.sh
rustfmt_excluded_files

index 1a9053a28dd6fe2ee36a2c4ad3ed9e168faf24a9..973f79ebe5c5ae9fc51a5a9a2f819a7222a083f2 100755 (executable)
@@ -14,7 +14,7 @@ VERS=""
 
 # Run fmt
 TMP_FILE=$(mktemp)
-find . -name '*.rs' -type f |sort >"$TMP_FILE"
+git ls-files | grep '.rs$' | sort >"$TMP_FILE"
 for file in $(comm -23 "$TMP_FILE" rustfmt_excluded_files); do
        echo "Checking formatting of $file"
        rustfmt $VERS --edition 2021 --check "$file"
index ffce4242f3ef24d5b5678436eba155ad6b403213..2ef82c5a3e4ed327bfa87ef7a00a1d979e97cbff 100755 (executable)
@@ -14,7 +14,7 @@ VERS=""
 
 # Run fmt
 TMP_FILE=$(mktemp)
-find . -name '*.rs' -type f |sort >"$TMP_FILE"
+git ls-files | grep '.rs$' | sort >"$TMP_FILE"
 for file in $(comm -23 "$TMP_FILE" rustfmt_excluded_files); do
        echo "Formatting $file..."
        rustfmt $VERS --edition 2021 "$file"
index ef7fa85e913f51fce653cd5967b90f650b5c44d3..16bc8200088c19deddc7deb4f40bca4a7dad819a 100644 (file)
@@ -1,96 +1,96 @@
-./lightning-invoice/fuzz/fuzz_targets/serde_data_part.rs
-./lightning-invoice/src/de.rs
-./lightning-invoice/src/lib.rs
-./lightning-invoice/src/payment.rs
-./lightning-invoice/src/ser.rs
-./lightning-invoice/src/tb.rs
-./lightning-invoice/src/utils.rs
-./lightning-invoice/tests/ser_de.rs
-./lightning/src/blinded_path/message.rs
-./lightning/src/blinded_path/mod.rs
-./lightning/src/blinded_path/payment.rs
-./lightning/src/blinded_path/utils.rs
-./lightning/src/chain/chaininterface.rs
-./lightning/src/chain/chainmonitor.rs
-./lightning/src/chain/channelmonitor.rs
-./lightning/src/chain/mod.rs
-./lightning/src/chain/onchaintx.rs
-./lightning/src/chain/package.rs
-./lightning/src/chain/transaction.rs
-./lightning/src/events/bump_transaction.rs
-./lightning/src/events/mod.rs
-./lightning/src/lib.rs
-./lightning/src/ln/async_signer_tests.rs
-./lightning/src/ln/blinded_payment_tests.rs
-./lightning/src/ln/chan_utils.rs
-./lightning/src/ln/chanmon_update_fail_tests.rs
-./lightning/src/ln/channel.rs
-./lightning/src/ln/channel_id.rs
-./lightning/src/ln/channelmanager.rs
-./lightning/src/ln/features.rs
-./lightning/src/ln/functional_test_utils.rs
-./lightning/src/ln/functional_tests.rs
-./lightning/src/ln/inbound_payment.rs
-./lightning/src/ln/invoice_utils.rs
-./lightning/src/ln/max_payment_path_len_tests.rs
-./lightning/src/ln/mod.rs
-./lightning/src/ln/monitor_tests.rs
-./lightning/src/ln/msgs.rs
-./lightning/src/ln/offers_tests.rs
-./lightning/src/ln/onion_payment.rs
-./lightning/src/ln/onion_route_tests.rs
-./lightning/src/ln/outbound_payment.rs
-./lightning/src/ln/payment_tests.rs
-./lightning/src/ln/peer_channel_encryptor.rs
-./lightning/src/ln/peer_handler.rs
-./lightning/src/ln/priv_short_conf_tests.rs
-./lightning/src/ln/reload_tests.rs
-./lightning/src/ln/reorg_tests.rs
-./lightning/src/ln/script.rs
-./lightning/src/ln/shutdown_tests.rs
-./lightning/src/ln/types.rs
-./lightning/src/ln/wire.rs
-./lightning/src/offers/invoice.rs
-./lightning/src/offers/invoice_error.rs
-./lightning/src/offers/invoice_request.rs
-./lightning/src/offers/merkle.rs
-./lightning/src/offers/mod.rs
-./lightning/src/offers/offer.rs
-./lightning/src/offers/parse.rs
-./lightning/src/offers/payer.rs
-./lightning/src/offers/refund.rs
-./lightning/src/offers/signer.rs
-./lightning/src/offers/test_utils.rs
-./lightning/src/onion_message/functional_tests.rs
-./lightning/src/onion_message/messenger.rs
-./lightning/src/onion_message/mod.rs
-./lightning/src/onion_message/offers.rs
-./lightning/src/onion_message/packet.rs
-./lightning/src/routing/gossip.rs
-./lightning/src/routing/mod.rs
-./lightning/src/routing/router.rs
-./lightning/src/routing/scoring.rs
-./lightning/src/routing/test_utils.rs
-./lightning/src/routing/utxo.rs
-./lightning/src/util/atomic_counter.rs
-./lightning/src/util/base32.rs
-./lightning/src/util/byte_utils.rs
-./lightning/src/util/config.rs
-./lightning/src/util/errors.rs
-./lightning/src/util/fuzz_wrappers.rs
-./lightning/src/util/indexed_map.rs
-./lightning/src/util/invoice.rs
-./lightning/src/util/logger.rs
-./lightning/src/util/macro_logger.rs
-./lightning/src/util/message_signing.rs
-./lightning/src/util/mod.rs
-./lightning/src/util/persist.rs
-./lightning/src/util/scid_utils.rs
-./lightning/src/util/ser.rs
-./lightning/src/util/ser_macros.rs
-./lightning/src/util/string.rs
-./lightning/src/util/test_channel_signer.rs
-./lightning/src/util/test_utils.rs
-./lightning/src/util/time.rs
-./lightning/src/util/transaction_utils.rs
-./lightning/src/util/wakers.rs
+lightning-invoice/fuzz/fuzz_targets/serde_data_part.rs
+lightning-invoice/src/de.rs
+lightning-invoice/src/lib.rs
+lightning-invoice/src/payment.rs
+lightning-invoice/src/ser.rs
+lightning-invoice/src/tb.rs
+lightning-invoice/src/utils.rs
+lightning-invoice/tests/ser_de.rs
+lightning/src/blinded_path/message.rs
+lightning/src/blinded_path/mod.rs
+lightning/src/blinded_path/payment.rs
+lightning/src/blinded_path/utils.rs
+lightning/src/chain/chaininterface.rs
+lightning/src/chain/chainmonitor.rs
+lightning/src/chain/channelmonitor.rs
+lightning/src/chain/mod.rs
+lightning/src/chain/onchaintx.rs
+lightning/src/chain/package.rs
+lightning/src/chain/transaction.rs
+lightning/src/events/bump_transaction.rs
+lightning/src/events/mod.rs
+lightning/src/lib.rs
+lightning/src/ln/async_signer_tests.rs
+lightning/src/ln/blinded_payment_tests.rs
+lightning/src/ln/chan_utils.rs
+lightning/src/ln/chanmon_update_fail_tests.rs
+lightning/src/ln/channel.rs
+lightning/src/ln/channel_id.rs
+lightning/src/ln/channelmanager.rs
+lightning/src/ln/features.rs
+lightning/src/ln/functional_test_utils.rs
+lightning/src/ln/functional_tests.rs
+lightning/src/ln/inbound_payment.rs
+lightning/src/ln/invoice_utils.rs
+lightning/src/ln/max_payment_path_len_tests.rs
+lightning/src/ln/mod.rs
+lightning/src/ln/monitor_tests.rs
+lightning/src/ln/msgs.rs
+lightning/src/ln/offers_tests.rs
+lightning/src/ln/onion_payment.rs
+lightning/src/ln/onion_route_tests.rs
+lightning/src/ln/outbound_payment.rs
+lightning/src/ln/payment_tests.rs
+lightning/src/ln/peer_channel_encryptor.rs
+lightning/src/ln/peer_handler.rs
+lightning/src/ln/priv_short_conf_tests.rs
+lightning/src/ln/reload_tests.rs
+lightning/src/ln/reorg_tests.rs
+lightning/src/ln/script.rs
+lightning/src/ln/shutdown_tests.rs
+lightning/src/ln/types.rs
+lightning/src/ln/wire.rs
+lightning/src/offers/invoice.rs
+lightning/src/offers/invoice_error.rs
+lightning/src/offers/invoice_request.rs
+lightning/src/offers/merkle.rs
+lightning/src/offers/mod.rs
+lightning/src/offers/offer.rs
+lightning/src/offers/parse.rs
+lightning/src/offers/payer.rs
+lightning/src/offers/refund.rs
+lightning/src/offers/signer.rs
+lightning/src/offers/test_utils.rs
+lightning/src/onion_message/functional_tests.rs
+lightning/src/onion_message/messenger.rs
+lightning/src/onion_message/mod.rs
+lightning/src/onion_message/offers.rs
+lightning/src/onion_message/packet.rs
+lightning/src/routing/gossip.rs
+lightning/src/routing/mod.rs
+lightning/src/routing/router.rs
+lightning/src/routing/scoring.rs
+lightning/src/routing/test_utils.rs
+lightning/src/routing/utxo.rs
+lightning/src/util/atomic_counter.rs
+lightning/src/util/base32.rs
+lightning/src/util/byte_utils.rs
+lightning/src/util/config.rs
+lightning/src/util/errors.rs
+lightning/src/util/fuzz_wrappers.rs
+lightning/src/util/indexed_map.rs
+lightning/src/util/invoice.rs
+lightning/src/util/logger.rs
+lightning/src/util/macro_logger.rs
+lightning/src/util/message_signing.rs
+lightning/src/util/mod.rs
+lightning/src/util/persist.rs
+lightning/src/util/scid_utils.rs
+lightning/src/util/ser.rs
+lightning/src/util/ser_macros.rs
+lightning/src/util/string.rs
+lightning/src/util/test_channel_signer.rs
+lightning/src/util/test_utils.rs
+lightning/src/util/time.rs
+lightning/src/util/transaction_utils.rs
+lightning/src/util/wakers.rs