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

Actually return the error #366

Merged
merged 2 commits into from
Apr 25, 2022
Merged

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 :)

@@ -46,7 +46,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> SortedMultiVec<Pk, Ctx> {
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!

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