Skip to content

Followups to onion_message rustfmt #3582

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

As we rustfmt files, we should try to clean them up. Some lines we have are too long for reasons unrelated to actually needing to be long, and often really could use some intermediate variables to make things more readable.

In one case we also should have used a constant in a test, which rustfmt made more confusing because the comment was moved down below the for loop and no longer was referencing the for loop.

In one further case rustfmt made a total mess of some generics that were actually unnecessary and could just be removed.

In 3c3e93e we ran rustfmt blindly
on `lightning/src/onion_message/functional_tests.rs`. This left
the file with a handful of warts that really should have been
cleaned up as we went.

Here we clean up types a bit by importing structs directly and
adding a few type aliases.
In 3c3e93e we ran rustfmt blindly
on `lightning/src/onion_message/functional_tests.rs`. This left
the file with a handful of warts that really should have been
cleaned up as we went.

Here we clean up a handful of rustfmt-isms, ranging from terrible
to somewhat ugly, introduced in `functional_tests.rs`.
In 3c3e93e we ran rustfmt blindly
on `lightning/src/onion_message/functional_tests.rs`. This left
the file with a handful of warts that really should have been
cleaned up as we went.

Here we take the opportunity to clean up the `peer_buffer_full`
test which used a constant for the number of messages we can push
before the buffer fills, rather than calculating the amount based
on the buffer size constant, also removing a comment that got moved
by rustfmt into a place where it was no longer understandable.
In ecbab29 we ran rustfmt blindly
on `lightning/src/onion_message/messenger.rs`. This exposed a few
untidy things in the file and made them worse, which we should have
cleaned up as we went.

Here we address these, removing some unnecessary generics,
condensing some lines by adding intermediate variables, and
reducing very vertical match statements.
Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

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

Sure, LGTM

Landing this as it's trivial code rearrangement.

@tnull tnull merged commit a91196b into lightningdevkit:main Feb 2, 2025
24 of 25 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.

2 participants