Skip to content

Re-enable rustfmt on the lightning crate #3825

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

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

In d257b8a85a79b04faffa397a18a133f226c77804 we dropped our old
`rustfmt` per-file exclusion logic and replaced it with
`rustfmt_skip` tags in each previously-skipped files. This had the
unintended consequence of fully disabling `rustfmt` across the
`lightning` crate:

`rustfmt` operates recursively across files in any module it is
told to format. Previously, because we were running `rustfmt` on
each non-excluded file, this meant we wanted to exclude `mod.rs`
and `lib.rs` files - not doing so would result in the entire
module/crate being formatted. However, `cargo fmt --check` only
runs `rustfmt` once - on `lib.rs`. Because we added a top-level
`rustfmt_skip` in `lib.rs` this caused `rustfmt` to ignore it and
all modules.

In d257b8a we dropped our old
`rustfmt` per-file exclusion logic and replaced it with
`rustfmt_skip` tags in each previously-skipped files. This had the
unintended consequence of fully disabling `rustfmt` across the
`lightning` crate:

`rustfmt` operates recursively across files in any module it is
told to format. Previously, because we were running `rustfmt` on
each non-excluded file, this meant we wanted to exclude `mod.rs`
and `lib.rs` files - not doing so would result in the entire
module/crate being formatted. However, `cargo fmt --check` only
runs `rustfmt` once - on `lib.rs`. Because we added a top-level
`rustfmt_skip` in `lib.rs` this caused `rustfmt` to ignore it and
all modules.

Here we prepare to fix this by formatting
`lightning/src/chain/mod.rs`.
In d257b8a we dropped our old
`rustfmt` per-file exclusion logic and replaced it with
`rustfmt_skip` tags in each previously-skipped files. This had the
unintended consequence of fully disabling `rustfmt` across the
`lightning` crate:

`rustfmt` operates recursively across files in any module it is
told to format. Previously, because we were running `rustfmt` on
each non-excluded file, this meant we wanted to exclude `mod.rs`
and `lib.rs` files - not doing so would result in the entire
module/crate being formatted. However, `cargo fmt --check` only
runs `rustfmt` once - on `lib.rs`. Because we added a top-level
`rustfmt_skip` in `lib.rs` this caused `rustfmt` to ignore it and
all modules.

Here we prepare to fix this by formatting
`lightning/src/ln/mod.rs`.
In d257b8a we dropped our old
`rustfmt` per-file exclusion logic and replaced it with
`rustfmt_skip` tags in each previously-skipped files. This had the
unintended consequence of fully disabling `rustfmt` across the
`lightning` crate:

`rustfmt` operates recursively across files in any module it is
told to format. Previously, because we were running `rustfmt` on
each non-excluded file, this meant we wanted to exclude `mod.rs`
and `lib.rs` files - not doing so would result in the entire
module/crate being formatted. However, `cargo fmt --check` only
runs `rustfmt` once - on `lib.rs`. Because we added a top-level
`rustfmt_skip` in `lib.rs` this caused `rustfmt` to ignore it and
all modules.

Here we prepare to fix this by formatting
`lightning/src/routing/mod.rs`.
In d257b8a we dropped our old
`rustfmt` per-file exclusion logic and replaced it with
`rustfmt_skip` tags in each previously-skipped files. This had the
unintended consequence of fully disabling `rustfmt` across the
`lightning` crate:

`rustfmt` operates recursively across files in any module it is
told to format. Previously, because we were running `rustfmt` on
each non-excluded file, this meant we wanted to exclude `mod.rs`
and `lib.rs` files - not doing so would result in the entire
module/crate being formatted. However, `cargo fmt --check` only
runs `rustfmt` once - on `lib.rs`. Because we added a top-level
`rustfmt_skip` in `lib.rs` this caused `rustfmt` to ignore it and
all modules.

Here we resume `rustfmt`'ing the `lightning` crate by removing the
`rustfmt_skip` in `lightning/src/lib.rs` (and `rustfmt`'ing
`lightning/src/lib.rs`.
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jun 3, 2025

I've assigned @joostjager as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@TheBlueMatt TheBlueMatt merged commit 36fe491 into lightningdevkit:main Jun 3, 2025
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants