From: Matt Corallo Date: Wed, 18 Sep 2024 18:03:11 +0000 (+0000) Subject: Only attempt to `rustfmt` files checked into git X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=refs%2Fheads%2F2024-09-local-ci-rustfmt;p=rust-lightning Only attempt to `rustfmt` files checked into git 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); +} ``` --- diff --git a/ci/rustfmt.sh b/ci/rustfmt.sh index 1a9053a28..973f79ebe 100755 --- a/ci/rustfmt.sh +++ b/ci/rustfmt.sh @@ -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" diff --git a/contrib/run-rustfmt.sh b/contrib/run-rustfmt.sh index ffce4242f..2ef82c5a3 100755 --- a/contrib/run-rustfmt.sh +++ b/contrib/run-rustfmt.sh @@ -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" diff --git a/rustfmt_excluded_files b/rustfmt_excluded_files index ef7fa85e9..16bc82000 100644 --- a/rustfmt_excluded_files +++ b/rustfmt_excluded_files @@ -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