281af7c1b9 Move broken-intra-doc-link lint config to command line (Tobin C. Harding)
Pull request description:
The docs lint `broken-intra-doc-links` has been changed but the new name
is not available in our MSRV, this means we get a build warning. We only
build docs with the nightly toolchain so we can move this lint control
to the docs build command in `test.sh` instead of doing it crate wide.
With this patch applied devs risk not noticing docs link issues until
they hit them on CI _if_ they do not build with the test script or
explicitly pass in `-- -D rustdoc::broken-intra-doc-links`, which no one
is going to do. Hence we add a line to the readme with a shell alias
that can be used to check docs, taken directly from `test.sh`.
ACKs for top commit:
apoelstra:
ACK 281af7c1b9
Kixunil:
ACK 281af7c1b9
Tree-SHA512: 7c9be3bcf097444a107199c9e9df62324d80b770659556a81eca160b807245e15921cda812f83e8b24d41716273704ff7b78be9300680f1efef3cb1fbffe6afd
The docs lint `broken-intra-doc-links` has been changed but the new name
is not available in our MSRV, this means we get a build warning. We only
build docs with the nightly toolchain so we can move this lint control
to the docs build command in `test.sh` instead of doing it crate wide.
With this patch applied devs risk not noticing docs link issues until
they hit them on CI _if_ they do not build with the test script or
explicitly pass in `-- -D rustdoc::broken-intra-doc-links`, which no one
is going to do. Hence we add a line to the readme with a shell alias
that can be used to check docs, taken directly from `test.sh`.
7a3bb7d3ec Replace runtime size check with compile time check (Tobin C. Harding)
Pull request description:
Add a macro `const_assert` that uses some const declaration trickery to trigger a compile time error if a boolean expression is false.
Replace runtime checks using `debug_assert_eq!` with the newly defined `const_asert!` macro.
## Note
This PR is the first patch from a [recently closed PR](https://github.com/rust-bitcoin/rust-bitcoin/pull/953). Props to @elichai for the macro idea in the review of that PR.
ACKs for top commit:
Kixunil:
ACK 7a3bb7d3ec
apoelstra:
ACK 7a3bb7d3ec
Tree-SHA512: cfd4dcf6c66e06796cab6dc49445f0f8c5d4e686893a17735420dccedd75ad7c632d240a5ab92ee47ce459b799daeaf3fdf9c6b77c1b81b09e87197a9f86c5ba
Currently we are using the fragment-specifier `expr` in a bunch of
macros for captures that are only used for literals. If we use `literal`
instead it allows the compiler to give slightly more specific error
messages.
The benefits of this change are minor. Of note, this patch found one
unusual macro call site (removed unnecessary `&`).
The macros changed are all internal macros, this is not a breaking change.
Add a macro `const_assert` that uses some const declaration trickery to
trigger a compile time error if a boolean expression is false.
Replace runtime checks using `debug_assert_eq!` with the newly defined
`const_assert!` macro.
ec8dadaf86 Implement iter::size_hint and ExactSizeIterator for Witness Iter (Riccardo Casatta)
Pull request description:
close https://github.com/rust-bitcoin/rust-bitcoin/issues/1050
I don't think we need to change the `collect` since it use the `size_hint()` lower bound to initially allocate
// with size_hint
// test blockdata::witness::benches::bench_big_witness_to_vec ... bench: 313 ns/iter (+/- 13)
// test blockdata::witness::benches::bench_witness_to_vec ... bench: 204 ns/iter (+/- 11)
// without
// test blockdata::witness::benches::bench_big_witness_to_vec ... bench: 489 ns/iter (+/- 28)
// test blockdata::witness::benches::bench_witness_to_vec ... bench: 221 ns/iter (+/- 102)
The reason why the small witness doesn't get big perf boost is because by default vec allocates 4 slots
ACKs for top commit:
Kixunil:
ACK ec8dadaf86
apoelstra:
ACK ec8dadaf86
Tree-SHA512: dbe09ba6ebd4014fe0639412894beedab6cc7e844a5ec1697af8f0694b62ae5d423a801df1b48ac7029444c01877975e2d5168728f038fbd4f5808bda90e0f2f
abfeb32e35 Remove unnecessary local variable (Tobin C. Harding)
04b09a4e8d Remove unused loop (Tobin C. Harding)
380e0016cc Use write_all instead of write (Tobin C. Harding)
Pull request description:
Done while clearing clippy warnings, done as a separate PR because its not a simple glance to review like the others.
Remove 2 clippy warnings and remove unnecessary local variable.
ACKs for top commit:
apoelstra:
ACK abfeb32e35
Kixunil:
ACK abfeb32e35
Tree-SHA512: 965708999c067dd8c156bbc54b711f608d524fab7051a0e56066f53b5c8d7bea1c233f04e77873b2624cd22e26a58f1d22f47870d2afe4347aa85335c3142245
The `ParseAmountError` does not implement `std::error::Error`, must have
been missed when we did the rest.
Implement `std::error::Error` for `ParseAmount`.
7743be00cf Removed edition change heads up from CONTRIBUTING (Martin Habovštiak)
Pull request description:
It is done.
ACKs for top commit:
apoelstra:
ACK 7743be00cf
sanket1729:
ACK 7743be00cf
Tree-SHA512: 9cc63a97d959061db1b04757fbf993a5f2cf0e1fff388b23a8729995bf764aced18b3ef49ec25a5a324d8e49168b9e841baf2118f0769fc8689f46c3d9b3463c
29cfdc8614 README: remove stale info about upcoming edition change (Dawid Ciężarkiewicz)
Pull request description:
It is done.
ACKs for top commit:
tcharding:
ACK 29cfdc8614
apoelstra:
ACK 29cfdc8614
sanket1729:
ACK 29cfdc8614
Tree-SHA512: fc5b694229e4a3ebcc8f25cd4d73b65cb798d441934b2e2b473c0811367bb9c5bd6cfae9e5b68b072e3c6320f386ab54138b8589a57fc0816702474ab6de06f8
66e852cd19 Update format of ExcessiveScriptSize error message (eunoia_1729)
89bd4b61a4 Modify from_script functions in address.rs to return result (eunoia_1729)
Pull request description:
Modify from_script functions to return result instead of option so that, in case of errors, there is more
information on what went wrong.
Resolves: #1022
ACKs for top commit:
sanket1729:
ACK 66e852cd19. LGTM
tcharding:
ACK 66e852cd19
apoelstra:
ACK 66e852cd19
Tree-SHA512: 0d9529aee0a5459351bed2cc8b2c5571736d3293e2931c43d98f53330e9ac5f3d998a19da2b4575af0a3c1c4dcfd5a24c8813390bf6f5492a689c36ebb9cb426
Modify from_script functions to return result instead of option so that, in case of errors, there is more
information on what went wrong.
Resolves: #1022
271d0ba068 Allow many arguments in test function (Tobin C. Harding)
c0c88fe87d Use vec instead of pushing to a mutable vector (Tobin C. Harding)
73066e7e48 Use values() to iterate map values (Tobin C. Harding)
38ff025122 Remove useless use of vec! (Tobin C. Harding)
d8e82d5cd4 Remove length comparison to zero (Tobin C. Harding)
c1f34f5c0e Return Address directly (Tobin C. Harding)
ff8d585c17 Use flat_map instead of map().flatten() (Tobin C. Harding)
b24a112f08 Remove calls to clone from types that implement Copy (Tobin C. Harding)
2b8d93ec4b Remove unnecessary explicit reference (Tobin C. Harding)
ef90e3d4ed Use plus-equals operator (Tobin C. Harding)
922b820105 Replace assert!(false) with panic! (Tobin C. Harding)
a8039e1742 Remove redundant clone (Tobin C. Harding)
cf8de73169 Remove unnecessary cast of integer literal (Tobin C. Harding)
999ac450bb Do not use assert_eq with literal bool (Tobin C. Harding)
827fcd8a89 Allow unusual digit grouping (Tobin C. Harding)
242c640603 Remove redundant field names (Tobin C. Harding)
0f8f4c5609 Collapse if statements (Tobin C. Harding)
229fcb9f1f Use if let instead of destructuring pattern (Tobin C. Harding)
Pull request description:
Clear all the clippy warnings (excl. #1042) that are returned by running `cargo clippy --all-targets`.
I apologize in advance for the review burden :)
ACKs for top commit:
elichai:
ACK 271d0ba068
apoelstra:
ACK 271d0ba068
Tree-SHA512: 71ad2ec3db808e795791b7513f8b2a1c13dc90317f5328602c9ecbc31c09f82471f79c9c31a71a0ded5280554d1019d2bb4899fb9e8fa6421d46a2397cd31242
Clippy emits:
warning: using `clone` on type `blockdata::transaction::OutPoint`
which implements the `Copy` trait
Remove calls to `clone` from types that implement `Copy`.
Clippy warns about creating a reference that is immediately
de-referenced.
Remove unnecessary explicit `&`, while we are at it remove unnecessary
explicit types that appear on the same lines of code.
We only simulate a single connection in the test function `serve_tcp`.
Remove the unused loop (includes an unconditional break after first
iteration) and use `next` directly.
Found by clippy. Refactor only, no logic changes.
Clippy emits:
warning: digits grouped inconsistently by underscores
Add allow directive for grouping that aims to make explicit 100,000,000
sats/per bitcoin.
28049ce2d9 Document `Txid` being displayed backwards (Dawid Ciężarkiewicz)
Pull request description:
Fix#958
I hope putting it on the most notorious type where people actually notice it is enough. I couldn't find a good way to put it on all other `sha256d` automatically, and copy pasting it seems not worth it.
ACKs for top commit:
tcharding:
ACK 28049ce2d9
apoelstra:
ACK 28049ce2d9
Tree-SHA512: a5acf5d7a73361a6c48b45ed264fafb911930ae9f1bdb03895dc39c679d508dc56dbf44896fd38cf6569abb652e7fce721028ef06344462747a77078ef5a8f4f
99aab446c3 Remove network::Error (Tobin C. Harding)
Pull request description:
The `network::Error` is not used, remove it.
(This description has been changed, the thumbs up emojis were put on the previous PR description.)
ACKs for top commit:
sanket1729:
reACK 99aab446c3
apoelstra:
ACK 99aab446c3
Tree-SHA512: 2342531160966860b7b65f8c5df10e169876ec446e6fd30093d5d81d0b0304cad04e2c2057eb3ca6b23a2fc56453c91ad4ddf426d3796fb301acb7f7d03a66b9
43b684bbe6 Add non_exhaustive compiler directive to AddressType (Tobin C. Harding)
Pull request description:
Add non_exhaustive compiler directive to AddressType
Currently adding variants to enums is a breaking change. In an effort to
reduce the upgrade burden on users we can use the `non_exhaustive`
compiler directive so that adding a new variant does not cause
downstream code to break.
Add `non_exhaustive` to the `AddressType` since it may be extended in
the future.
ACKs for top commit:
sanket1729:
ACK 43b684bbe6
Kixunil:
ACK 43b684bbe6
apoelstra:
ACK 43b684bbe6
Tree-SHA512: 2b2a15fb501d23058acca94318776ffcccedf463d43d07afa290fba46a7bd58b3a730f6e1f25605ef399afcfdb5de4c7ad67eaa0adff0ba39b0096cbcec10f57