Skip to content

Convert file-level rustfmt skip to fn level skips #3809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 26 additions & 27 deletions fuzz/src/msg_targets/mod.rs
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
mod utils;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was put here deliberately as we opted against running rustfmt on autogenerated files. We need to fix it either way, likely just revert it to include the skip.

pub mod msg_accept_channel;
pub mod msg_accept_channel_v2;
pub mod msg_announcement_signatures;
pub mod msg_channel_announcement;
pub mod msg_channel_details;
pub mod msg_channel_ready;
pub mod msg_channel_reestablish;
pub mod msg_channel_update;
pub mod msg_closing_signed;
pub mod msg_commitment_signed;
pub mod msg_decoded_onion_error_packet;
pub mod msg_error_message;
pub mod msg_funding_created;
pub mod msg_channel_ready;
pub mod msg_funding_signed;
pub mod msg_gossip_timestamp_filter;
pub mod msg_init;
pub mod msg_node_announcement;
pub mod msg_open_channel;
pub mod msg_open_channel_v2;
pub mod msg_ping;
pub mod msg_pong;
pub mod msg_query_channel_range;
pub mod msg_query_short_channel_ids;
pub mod msg_reply_channel_range;
pub mod msg_reply_short_channel_ids_end;
pub mod msg_revoke_and_ack;
pub mod msg_shutdown;
pub mod msg_splice_ack;
pub mod msg_splice_init;
pub mod msg_splice_locked;
pub mod msg_stfu;
pub mod msg_tx_abort;
pub mod msg_tx_ack_rbf;
pub mod msg_tx_add_input;
pub mod msg_tx_add_output;
pub mod msg_tx_complete;
pub mod msg_tx_init_rbf;
pub mod msg_tx_remove_input;
pub mod msg_tx_remove_output;
pub mod msg_tx_signatures;
pub mod msg_update_add_htlc;
pub mod msg_update_fail_htlc;
pub mod msg_update_fail_malformed_htlc;
pub mod msg_update_fee;
pub mod msg_update_fulfill_htlc;
pub mod msg_channel_reestablish;
pub mod msg_decoded_onion_error_packet;
pub mod msg_channel_announcement;
pub mod msg_node_announcement;
pub mod msg_channel_update;
pub mod msg_query_short_channel_ids;
pub mod msg_reply_channel_range;
pub mod msg_error_message;
pub mod msg_warning_message;
pub mod msg_channel_details;
pub mod msg_open_channel_v2;
pub mod msg_accept_channel_v2;
pub mod msg_tx_add_input;
pub mod msg_tx_add_output;
pub mod msg_tx_remove_input;
pub mod msg_tx_remove_output;
pub mod msg_tx_complete;
pub mod msg_tx_signatures;
pub mod msg_tx_init_rbf;
pub mod msg_tx_ack_rbf;
pub mod msg_tx_abort;
pub mod msg_stfu;
pub mod msg_splice_init;
pub mod msg_splice_ack;
pub mod msg_splice_locked;
mod utils;
20 changes: 14 additions & 6 deletions lightning/src/chain/chaininterface.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(rustfmt, rustfmt_skip)]

// This file is Copyright its original authors, visible in version control
// history.
//
Expand Down Expand Up @@ -189,14 +187,20 @@ pub const FEERATE_FLOOR_SATS_PER_KW: u32 = 253;
///
/// Note that this does *not* implement [`FeeEstimator`] to make it harder to accidentally mix the
/// two.
pub(crate) struct LowerBoundedFeeEstimator<F: Deref>(pub F) where F::Target: FeeEstimator;

impl<F: Deref> LowerBoundedFeeEstimator<F> where F::Target: FeeEstimator {
pub(crate) struct LowerBoundedFeeEstimator<F: Deref>(pub F)
where
F::Target: FeeEstimator;

impl<F: Deref> LowerBoundedFeeEstimator<F>
where
F::Target: FeeEstimator,
{
/// Creates a new `LowerBoundedFeeEstimator` which wraps the provided fee_estimator
pub fn new(fee_estimator: F) -> Self {
LowerBoundedFeeEstimator(fee_estimator)
}

#[rustfmt::skip]
pub fn bounded_sat_per_1000_weight(&self, confirmation_target: ConfirmationTarget) -> u32 {
cmp::max(
self.0.get_est_sat_per_1000_weight(confirmation_target),
Expand All @@ -207,7 +211,9 @@ impl<F: Deref> LowerBoundedFeeEstimator<F> where F::Target: FeeEstimator {

#[cfg(test)]
mod tests {
use super::{FEERATE_FLOOR_SATS_PER_KW, LowerBoundedFeeEstimator, ConfirmationTarget, FeeEstimator};
use super::{
ConfirmationTarget, FeeEstimator, LowerBoundedFeeEstimator, FEERATE_FLOOR_SATS_PER_KW,
};

struct TestFeeEstimator {
sat_per_kw: u32,
Expand All @@ -220,6 +226,7 @@ mod tests {
}

#[test]
#[rustfmt::skip]
fn test_fee_estimator_less_than_floor() {
let sat_per_kw = FEERATE_FLOOR_SATS_PER_KW - 1;
let test_fee_estimator = &TestFeeEstimator { sat_per_kw };
Expand All @@ -229,6 +236,7 @@ mod tests {
}

#[test]
#[rustfmt::skip]
fn test_fee_estimator_greater_than_floor() {
let sat_per_kw = FEERATE_FLOOR_SATS_PER_KW + 1;
let test_fee_estimator = &TestFeeEstimator { sat_per_kw };
Expand Down
Loading
Loading