Skip to content

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented Sep 28, 2025

Nightly rustfmt allows to auto-group imports on the module level. While we're not quite convinced to switch to the nightly channel for this yet (mostly because not all contributors would have the right nightly version installed on their machines), we here make use of cargo +nightly fmt with some addtional import grouping options as a one-off. This cleans up our imports for the whole crate and gets us to a consistent state everywhere.

To reproduce, run cargo +nightly fmt with the following lines in rustfmt.toml enabled:

group_imports = "StdExternalCrate"
reorder_imports = true
imports_granularity = "Module"

@tnull tnull requested a review from joostjager September 28, 2025 09:00
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Sep 28, 2025

👋 Thanks for assigning @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.

Nightly `rustfmt` allows to auto-group imports on the module level.
While we're not quite convinced to switch to the nightly channel for
this yet (mostly because not all contributors would have the right
nightly version installed on their machines), we here make use of `cargo
+nightly fmt` with some addtional import grouping options as a one-off.
This cleans up our imports for the whole crate and gets us to a
consistent state everywhere.
@tnull tnull force-pushed the 2025-09-format-all-imports branch from fbe2f46 to 2ae3466 Compare September 28, 2025 09:03
# UNSTABLE: format_strings = true
# UNSTABLE: group_imports = "StdExternalCrate"
# UNSTABLE: reorder_imports = true
# UNSTABLE: imports_granularity = "Module"
Copy link
Contributor

@joostjager joostjager Sep 29, 2025

Choose a reason for hiding this comment

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

We put this in so that users who want to can still run the nightly version and get the imports fixed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, and this is the list of rustfmt features we want to enable once we can. Put them here also so we don't forget.

@tnull tnull merged commit 09eacfa into lightningdevkit:develop Sep 29, 2025
11 of 15 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.

3 participants