Skip to content

Conversation

@tcharding
Copy link
Member

We have what appears to be an error return but do not actually return
the error. This line needs an explicit return statement otherwise it
is a noop.

@apoelstra
Copy link
Member

Lol!! Could you add a unit test?

We have what appears to be an error return but do not actually return
the error. This line needs an explicit `return` statement otherwise it
is a noop.
The `SortedMultiVec` constructor appears to have a bug in it, add a unit
test to trigger the bug.
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 4d0e8fb

@apoelstra apoelstra merged commit 6fe4bce into rust-bitcoin:master Apr 25, 2022
@tcharding
Copy link
Member Author

Damn this merged, I was thinking last night that this unit test shouldn't be merged. Its informational but not useful to maintain. We do not explicitly unit test every error path in the code so it seems odd to have this one. Not to worry.

@tcharding tcharding deleted the return-error branch April 26, 2022 01:58
@apoelstra
Copy link
Member

I would prefer if we did unit test every error path :)

pub fn new(k: usize, pks: Vec<Pk>) -> Result<Self, Error> {
// A sortedmulti() is only defined for <= 20 keys (it maps to CHECKMULTISIG)
if pks.len() > MAX_PUBKEYS_PER_MULTISIG {
Error::BadDescriptor("Too many public keys".to_string());
Copy link
Member

Choose a reason for hiding this comment

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

post-merge comment: Does Clippy warn about this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you just need to upgrade to 2018 edition. It's a standard warning now: #[must_use]

Copy link
Member Author

Choose a reason for hiding this comment

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

Does Clippy warn about this?

ooo you got me, usually I always mention 'found by clippy' in the commit log but I forgot this time.

I think you just need to upgrade to 2018 edition

The PR is open!

heap-coder added a commit to heap-coder/rust-miniscript that referenced this pull request Sep 27, 2025
4d0e8fb7692a49dd140fa34711ef53a9f31b357a Add unit test SortedMultiVec constructor (Tobin C. Harding)
fb932f666be3b0dceab7258f5e63ed7aa9951a52 Actually return the error (Tobin C. Harding)

Pull request description:

  We have what appears to be an error return but do not actually return
  the error. This line needs an explicit `return` statement otherwise it
  is a noop.

ACKs for top commit:
  apoelstra:
    ACK 4d0e8fb7692a49dd140fa34711ef53a9f31b357a

Tree-SHA512: 7a79b678fb77e092415b78857a5b0bfd2b4cf58382858729f2e6c2d57d8c6b50fabcbe498fd12fee05d9886574a545ad568310df76609fe2eb123af861c4ad14
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.

4 participants