Skip to content
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

Do a bunch of cleanups #154

Merged
merged 3 commits into from
Oct 25, 2023
Merged

Conversation

tcharding
Copy link
Member

This is the first 4 patches from #142, pushing up separately because that PR is quite complicated to review well and these cleanups are unrelated.

@tcharding tcharding mentioned this pull request Oct 25, 2023
We have one single rustdoc line that does not use a fixed column width
as the rest do, this is likely an oversight - fix it.
In the `SegwitHrpstringError` we return the `MissingWitnessVersion`
variant when the encoded data is empty. While true, the witness version
is missing this error is not totally descriptive because the error case
is more specific than that.

Rename `SegwitHrpstringError::MissingWitnessVersion` to
`SegwitHrpstringError::NoData`.
The `crate::{encode, decode}` API is for encoding/decoding bech32
strings not specifically addresses (for example miniscript descriptors
are bech32 strings but not addresses).

Use the words "bech32 string" instead of "address" in `lib.rs`.
@apoelstra
Copy link
Member

Can you find a citation for the expect convention? A quick search suggests "there is no convention" and when written this way the error messages don't make sense.

@tcharding
Copy link
Member Author

tcharding commented Oct 25, 2023

Oh its definitely a convention, its one of the first ones I remember learning that I disagreed with when I first started Rusting. I patched an open source library with it too (yep I was that guy). I'll go digging for you ... hold the phone, the docs for Result literally use an expect with "failed to write message" - that is core enough to ignore this once-read-about convention IMO - WIN.

ref: https://doc.rust-lang.org/std/result/

@tcharding
Copy link
Member Author

tcharding commented Oct 25, 2023

Dropped the last patch (the expect convention one), no other changes.

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 8426386

@apoelstra apoelstra merged commit 2e06b36 into rust-bitcoin:master Oct 25, 2023
12 checks passed
@apoelstra apoelstra deleted the 10-25-clean-up branch October 25, 2023 22:26
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