rust-bitcoin / rust-bech32

Bech32 format encoding and decoding
MIT License
93 stars 49 forks source link

Do a bunch of cleanups #154

Closed tcharding closed 10 months ago

tcharding commented 10 months ago

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.

apoelstra commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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